This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| console.log('Loading function'); | |
| const request = require('request'); | |
| const https = require('https'); | |
| var PAGE_ACCESS_TOKEN; | |
| var MESSENGER_VALIDATION_TOKEN; | |
| exports.handler = (event, context, callback) => { | |
| MESSENGER_VALIDATION_TOKEN = event["stage-variables"]["MESSENGER_VALIDATION_TOKEN"] || "swordfish"; | |
| PAGE_ACCESS_TOKEN = event["stage-variables"]["PAGE_ACCESS_TOKEN"] ; | |
| console.log('Received event:', JSON.stringify(event, null, 2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package be.dhorions.test.boxable; | |
| import be.quodlibet.boxable.BaseTable; | |
| import be.quodlibet.boxable.Cell; | |
| import be.quodlibet.boxable.Row; | |
| import com.google.common.io.Files; | |
| import java.awt.Color; | |
| import java.io.File; | |
| import java.io.IOException; | |
| import org.apache.pdfbox.pdmodel.PDDocument; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JSONObject config = new JSONObject(); | |
| config.put("accessKeyId","REPLACE"); | |
| config.put("secretAccessKey","REPLACE"); | |
| config.put("region","eu-west-1"); | |
| config.put("tableName","testtable"); | |
| d2csv d = new d2csv(config); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tablenames=example_scaler,example_scaler2 | |
| #Table 1, changes 4 times per day | |
| # from 01:00 to 05:00 - Low usage | |
| 01.example_scaler.read=2 | |
| 01.example_scaler.write=2 | |
| #from 05:00 to 07:00 - Medium usage | |
| 05.example_scaler.read=6 | |
| 05.example_scaler.write=6 | |
| #from 07:00 to 18:00 - High usage | |
| 07.example_scaler.read=20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tablenames=example_scaler,example_scaler2 | |
| #Table 1, changes 4 times per day | |
| # from 01 to 07 - Low usage | |
| 01.example_scaler.read=2 | |
| 01.example_scaler.write=2 | |
| #from 07 to 09 - Medium usage | |
| 05.example_scaler.read=6 | |
| 05.example_scaler.write=6 | |
| #from 09 to 18 - High usage | |
| 07.example_scaler.read=20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private String scaleTable(String tableName, Long readCapacity, Long writeCapacity) | |
| { | |
| Table table = dynamoDB.getTable(tableName); | |
| ProvisionedThroughput tp = new ProvisionedThroughput(); | |
| tp.setReadCapacityUnits(readCapacity); | |
| tp.setWriteCapacityUnits(writeCapacity); | |
| TableDescription d = table.describe(); | |
| if (!Objects.equals(d.getProvisionedThroughput().getReadCapacityUnits(), readCapacity) | |
| || !Objects.equals(d.getProvisionedThroughput().getWriteCapacityUnits(), writeCapacity)) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Get the hour that was started | |
| Calendar rightNow = Calendar.getInstance(); | |
| String hour = String.format("%02d", rightNow.get(Calendar.HOUR_OF_DAY)); | |
| String message = "Scaling for hour : " + hour + "\n"; | |
| log(message); | |
| //Get the table names | |
| if (ScalingProperties.containsKey("tablenames")) | |
| { | |
| String value = (String) ScalingProperties.get("tablenames"); | |
| String[] tableNames = value.split(","); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ScalingProperties = new Properties(); | |
| S3Object object = s3Client.getObject(new GetObjectRequest(configBucketName, configKey)); | |
| S3ObjectInputStream stream = object.getObjectContent(); | |
| ScalingProperties.load(stream); |
NewerOlder