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
| /** | |
| * tske a {@link FilePart}, transfer it to disk using {@link AsynchronousFileChannel}s and return a {@link Mono} representing the result | |
| * | |
| * @param filePart - the request part containing the file to be saved | |
| * @return a {@link Mono} representing the result of the operation | |
| */ | |
| private Mono<String> saveFile(FilePart filePart) { | |
| LOGGER.info("handling file upload {}", filePart.filename()); | |
| // if a file with the same name already exists in a repository, delete and recreate it |
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
| #!/usr/bin/python | |
| import sys | |
| import Adafruit_DHT | |
| import json | |
| import urllib2 | |
| import time | |
| humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.AM2302, 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
| buildscript { | |
| ext { | |
| springBootVersion = '1.5.11.RELEASE' | |
| wrapperVersion = '1.0.9.RELEASE' | |
| shadowVersion = '2.0.1' | |
| } | |
| repositories { | |
| jcenter() | |
| mavenLocal() | |
| mavenCentral() |
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
| @SpringBootApplication | |
| public class Application { | |
| @Autowired | |
| ClimateReadingRepository climateReadingRepository; | |
| @Bean(name = "saveReadings") | |
| public Function<ClimateReading, ClimateReading> saveReadings() { | |
| return (reading) -> climateReadingRepository.save(reading); | |
| } |
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
| ... | |
| function.name=saveReadings | |
| ... |
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
| public interface ClimateReadingRepository extends CrudRepository<ClimateReading, String> { | |
| } |
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
| public class Handler extends SpringBootApiGatewayRequestHandler { | |
| } |
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
| liquibase.change-log=classpath:/db/liquibase-changelog.xml | |
| liquibase.enabled=true |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <databaseChangeLog | |
| xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" | |
| xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd | |
| http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> | |
| <changeSet id="2" author="ek"> | |
| <createTable tableName="climate_reading"> |
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
| #!/bin/sh | |
| aws rds create-db-instance \ | |
| --db-instance-identifier HomeAutomationDB \ | |
| --db-instance-class db.t2.micro \ | |
| --region eu-west-3 \ | |
| --engine postgres \ | |
| --allocated-storage 5 \ | |
| --no-publicly-accessible \ | |
| --db-name homeautomation \ |