def wind(event, context):
    wind = random.randint(0, 100)

    logger.info("Hello from somewhere in the cloud! This is the API /wind")

    monitor.send_to_dashboard(
        "There is maybe a little bit wind - Be cautious with your hat", wind)

    return response.create(message="Wind retrieved successfully", value=wind)
Beispiel #2
0
def brightness(event, context):
    brightness = random.randint(0, 100)

    logger.info(
        "Hello from somewhere in the cloud! This is the API /brightness")

    monitor.send_to_dashboard("There will be sunshine", brightness)

    return response.create(message="Brightness retrieved successfully",
                           value=brightness)
Beispiel #3
0
def humidity(event, context):
    humidity = random.randint(0, 120)

    logger.info("Hello from somewhere in the cloud! This is the API /humidity")

    monitor.send_to_dashboard(
        "There is will be rain - Take an umbrella with you", humidity)

    return response.create(message="humidity retrieved successfully",
                           value=humidity)
Beispiel #4
0
def stormwarning(event, context):
    stormwarning = random.randint(0, 1)

    logger.info(
        "Hello from somewhere in the cloud! This is the API /stormwarning")

    monitor.send_to_dashboard("There is a storm warning - Take shelter",
                              stormwarning)

    return response.create(message="Stormwarning retrieved successfully",
                           value=stormwarning)
Beispiel #5
0
def temperature(event, context):
    temperature = random.randint(30, 42)

    logger.info(
        "Hello from somewhere in the cloud! This is the API /temperature")

    monitor.send_to_dashboard("There are high temperatures - Margarita time",
                              temperature)

    return response.create(message="Temperature retrieved successfully",
                           value=temperature)
def temperature(event, context):

    sensor_value_in_kelvin = 305.15
    logger.info("This is the current temperature from a sensor: " +
                str(sensor_value_in_kelvin) + " in kelvin")

    temperature_in_celsius = convert_kelvin_to_fahrenheit(
        sensor_value_in_kelvin)
    logger.info("This is the converted temperature: " +
                str(temperature_in_celsius))

    monitor.send_to_dashboard("Sent temperature to monitoring",
                              temperature_in_celsius)

    return response.create(message="Temperature retrieved successfully",
                           value=temperature_in_celsius)
    def brightness(self, event) -> Dict[str, str]:
        #TODO: migrate all logic below to serverless_functions
        logger.info("Hello I am a monolith! This is my API /brightness")

        return response.create(
            message="Monoliths are so solid! Sunshine every day", value=60)
    def wind(self, event) -> Dict[str, str]:
        #TODO: migrate all logic below to serverless_functions
        logger.info("Hello I am a monolith! This is my API /wind")

        return response.create(
            message="Monoliths never break! Not even in a storm", value=3)
def wind(event, context):
    logger.info("Hello from somewhere in the cloud! This is the API /wind")

    return response.create(
        message="Your serverless function executed successfully!", value=3)