Skip to content

Commit

Permalink
adding link to code
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffnoehren committed Jan 23, 2018
1 parent 25fbd81 commit 390bf7c
Show file tree
Hide file tree
Showing 53 changed files with 371 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ li{
<div class="single-menu">
<h3>Languages</h3>
<ul>
<a href="./node"><li>Node</li></a>
<a href="./python"><li>Python</li></a>
<a href="./java8"><li>Java8</li></a>
<a href="./node-hello-world"><li>Node</li></a>
<a href="./python-hello-world"><li>Python</li></a>
<a href="./java8-hello-world"><li>Java8</li></a>
</ul>
</div>
<div class="single-menu">
Expand Down
2 changes: 2 additions & 0 deletions java8-elastigroup-scaleDown/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Scale Down Elastigroups

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/java8-elastigroup-scaleDown)

This function will connect to your Elastigroups and can scale down by a specific value using Java8.

## Download
Expand Down
2 changes: 2 additions & 0 deletions java8-elastigroup-scaleUp/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Scale Up Elastigroups

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/java8-elastigroup-scaleUp)

This function will connect to your Elastigroups and can scale up by a specific value using Java8.

## Download
Expand Down
3 changes: 3 additions & 0 deletions java8-elastigroup-setCapacity/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Set Elastigroup Capacity

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/java8-elastigroup-setTarget)


This function will connect to your Elastigroups and set the target, min and max capacity limits using Java8

## Download
Expand Down
Binary file added java8-hello-world/.DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions java8-hello-world/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# package directories
node_modules
jspm_packages

# Serverless directories
.serverless
13 changes: 13 additions & 0 deletions java8-hello-world/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "spotionst-java8",
"version": "1.0.0",
"description": "Spotinst Functions Java8 sample for serverless framework service.",
"main": "com.serverless.Handler.java",
"keywords": [
"serverless",
"spotinst"
],
"devDependencies": {
"serverless-spotinst-functions": "*"
}
}
51 changes: 51 additions & 0 deletions java8-hello-world/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.serverless</groupId>
<artifactId>hello</artifactId>
<version>dev</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.spotinst</groupId>
<artifactId>spotinst-functions-java-core</artifactId>
<version>1.1</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>

<build>
<!-- Your Service Name in serverless.yml -->
<finalName>spotinst-java8</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
39 changes: 39 additions & 0 deletions java8-hello-world/serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
#
# Happy Coding!

service: spotinst-java8

provider:
name: spotinst
#stage: <Stage Name> #Optional setting. By default it is set to 'dev'
spotinst:
#environment: <env-XXXX> # NOTE: Remember to add the environment ID

functions:
hello:
runtime: java8
handler: com.serverless.Handler
memory: 128
timeout: 30
access: private
# cron: # Setup scheduled trigger with cron expression
# active: true
# value: '* * * * *'
# environmentVariables: {
# Key: "Value",
# }

# extend the framework using plugins listed here:
# https://github.com/serverless/plugins
plugins:
- serverless-spotinst-functions
Binary file added java8-hello-world/src/.DS_Store
Binary file not shown.
Binary file added java8-hello-world/src/main/.DS_Store
Binary file not shown.
Binary file added java8-hello-world/src/main/java/.DS_Store
Binary file not shown.
Binary file added java8-hello-world/src/main/java/com/.DS_Store
Binary file not shown.
35 changes: 35 additions & 0 deletions java8-hello-world/src/main/java/com/serverless/Handler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.serverless;

import com.google.gson.JsonObject;
import com.spotinst.functions.runtime.Context;
import com.spotinst.functions.runtime.Request;
import com.spotinst.functions.runtime.RequestHandler;
import com.spotinst.functions.runtime.Response;

import java.util.HashMap;
import java.util.Map;

/**
* Please make sure your class implements the "RequestHandler" interface
* The return value should be of type "Response"
**/
public class Handler implements RequestHandler {

@Override
public Response handleRequest(Request request, Context context) {
Map<String, String> queryParams = request.getQueryParams();

String name = queryParams.get("name");
String responseBody = String.format("{\"hello\":\"%s\"}", name);

Response response = new Response(200, responseBody);

//Build response headers
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");

response.setHeaders(headers);

return response;
}
}
2 changes: 2 additions & 0 deletions node-alexa-skill/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Alexa Skill That Runs on Spotinst and Allows you to Check Your Elastigroups

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-alexa-skill)

This project will allow you to create an Alexa skill that runs on Spotinst. This skill will query your Spotinst account and return information about your Elastigroups

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-datadog-event/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Connect Elastigroup to Data Dog Events

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-datadog-event)

This project we will connect your Elastigroups to Data Dog to send an event notification when you add, delete or have an unhealthy instance.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-datadog-metric/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Connect Elastigroup to Data Dog Metrics

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-datadog-connect)

This project we will connect your Elastigroups to Data Dog to send a report every minute to Data Dog on the number of instances you have as a metric.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-docstore-getAll/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Get All Values From Document Store

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-docstore-getAll)

This function will allow you to access your document store in a specific region and return all the key value pairs in the logs.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-docstore-newValue/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Insert New Value Into Document Store

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-docstore-newValue)

This function will allow you to insert a new key value pair into your document store in a specific environment

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-elastigroup-scaleDown/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Scale Down Elastigroups

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-elastigroup-scaleDown)

This function will connect to your Elastigroups and can scale down by a specific value.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-elastigroup-scaleUp/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Scale Up Elastigroups

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-elastigroup-scaleUp)

This function will connect to your Elastigroups and can scale up by a specific value.

## Download
Expand Down
3 changes: 3 additions & 0 deletions node-elastigroup-setTarget/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Set Elastigroup Targets

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-elastigroup-setTarget)


This function will connect to your Elastigroups and set the target, min and max capacity limits

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-emr-scaleDown/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Scale Down EMR Elastigroups

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-emr-scaleDown)

This function will connect to your EMR Elastigroups and can scale it down.

## Download
Expand Down
3 changes: 3 additions & 0 deletions node-emr-scaleUp/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Scale Up EMR Elastigroups

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-emr-scaleUp)


This function will connect to your EMR Elastigroups and can scale it up.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-emr-setTarget/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Set EMR Elastigroup Targets

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-emr-setTarget)

This function will connect to your EMR Elastigroups and set the max min and target.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-endpoint-addAlias/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Add Endpoint Alias

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-endpoint-addAlias)

This function will allow you to connect your environment to a hosted Alias.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-endpoint-addPattern/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Add Endpoint Pattern

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-endpoint-addPattern)

This function allow you to connect your functions to a specfic pattern under an alias

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-endpoint-deleteAlias/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Delete Endpoint Alias

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-endpoint-deleteAlias)

This function will delete an exsisting Alias endpoint connection.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-endpoint-deletePattern/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Delete Endpoint Pattern

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-endpoint-deletePattern)

This function will delete a specific endpoint pattern.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-endpoint-getAlias/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Get All Endpoint Alias

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-endpoint-getAlias)

This function will return all the endpoint alias in a specific environment.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-endpoint-getPattern/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Get All Endpoint Patterns

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-endpoint-getPattern)

This function will return all the endpoint patterns in a specific environment.

## Download
Expand Down
2 changes: 2 additions & 0 deletions node-endpoint-updatePattern/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Update Endpoint Pattern

[Check Out the Code](https://github.com/spotinst/spotinst-functions-examples/tree/master/node-endpoint-updatePattern)

This function allow you to connect your functions to a specfic pattern under an alias

## Download
Expand Down
6 changes: 6 additions & 0 deletions node-hello-world/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# package directories
node_modules
jspm_packages

# Serverless directories
.serverless
23 changes: 23 additions & 0 deletions node-hello-world/handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
*
* Implement your function here.
* The function will get the event as the first parameter with query/body properties:
* var queryparams = event.query;
* var body = event.body;
*
* The function should trigger the 'callback' with the following structure:
* callback(null, {
* statusCode: 200,
* body: '{"hello":"from NodeJS8.3 function"}',
* headers: {"Content-Type": "application/json"}
* })
*
*/

module.exports.main = function main (event, context, callback) {
callback(null, {
statusCode: 200,
body: '{"hello":"from NodeJS8.3 function"}',
headers: {"Content-Type": "application/json"}
});
};
13 changes: 13 additions & 0 deletions node-hello-world/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "spotionst-nodejs",
"version": "1.0.0",
"description": "Spotinst Functions NodeJS sample for serverless framework service.",
"main": "handler.js",
"keywords": [
"serverless",
"spotinst"
],
"devDependencies": {
"serverless-spotinst-functions": "*"
}
}
Loading

0 comments on commit 390bf7c

Please sign in to comment.