swagger_server/controllers/inputs_controller.py
def mqtt_input_source(MQTT_Input_Source):  # noqa: E501
    """Creates a new mqtt data source as input

     # noqa: E501

    :param MQTT_Input_Source: Data source to be created
    :type MQTT_Input_Source: dict | bytes

    :rtype: None
    """
    if connexion.request.is_json:
        try:
            MQTT_Input_Source = MQTTInputSource.from_dict(connexion.request.get_json())  # noqa: E501
            logger.info("This is the dictionary: " + MQTT_Input_Source.to_str())

            MQTT_Input_Source = connexion.request.get_json()

            input_header_validation(MQTT_Input_Source)
            ####generates an id an makes a directory with the id for the data and for the registry
            try:
                id = utils.create_and_get_ID()
                dir = os.path.join(os.getcwd(), "optimization/resources", str(id))
                if not os.path.exists(dir):
                    os.makedirs(dir)
                dir_data = os.path.join(os.getcwd(), "optimization/resources", str(id), "mqtt")
                if not os.path.exists(dir_data):
                    os.makedirs(dir_data)
            except Exception as e:
                logger.error(e)

            # saves the registry into the new folder
            path = os.path.join(os.getcwd(), "optimization/resources", str(id), "Input.registry.mqtt")
            with open(path, 'w') as outfile:
                json.dump(MQTT_Input_Source, outfile, ensure_ascii=False)
            logger.info("registry/input saved into memory")

            return "Instance created", 201, {'Location': str(id)}
            # return jsonify({'Data-Source-Id': str(id)})
        except Exception as e:
            logger.error("Invalid data " + str(e)), 400
            return str(e).replace("\"", "")
    else:
        return 'Data is not in json format', 400
Creates a new mqtt data source as input

     # noqa: E501

    :param MQTT_Input_Source: Data source to be created
    :type MQTT_Input_Source: dict | bytes

    :rtype: None
    
Creates a new mqtt data source as input
noqa: E501
Creates a new mqtt data source as input noqa : E501
def mqtt_input_source(MQTT_Input_Source):  
    """Creates a new mqtt data source as input
    :param MQTT_Input_Source: Data source to be created
    :type MQTT_Input_Source: dict | bytes
    :rtype: None
    """
    if connexion.request.is_json:
        try:
            MQTT_Input_Source = MQTTInputSource.from_dict(connexion.request.get_json())  
            logger.info("This is the dictionary: " + MQTT_Input_Source.to_str())
            MQTT_Input_Source = connexion.request.get_json()
            input_header_validation(MQTT_Input_Source)
            try:
                id = utils.create_and_get_ID()
                dir = os.path.join(os.getcwd(), "optimization/resources", str(id))
                if not os.path.exists(dir):
                    os.makedirs(dir)
                dir_data = os.path.join(os.getcwd(), "optimization/resources", str(id), "mqtt")
                if not os.path.exists(dir_data):
                    os.makedirs(dir_data)
            except Exception as e:
                logger.error(e)
            path = os.path.join(os.getcwd(), "optimization/resources", str(id), "Input.registry.mqtt")
            with open(path, 'w') as outfile:
                json.dump(MQTT_Input_Source, outfile, ensure_ascii=False)
            logger.info("registry/input saved into memory")
            return "Instance created", 201, {'Location': str(id)}
        except Exception as e:
            logger.error("Invalid data " + str(e)), 400
            return str(e).replace("\"", "")
    else:
        return 'Data is not in json format', 400
def mqtt_input_source ( MQTT_Input_Source ) : if connexion . request . is_json : try : MQTT_Input_Source = MQTTInputSource . from_dict ( connexion . request . get_json ( ) ) logger . info ( "This is the dictionary: " + MQTT_Input_Source . to_str ( ) ) MQTT_Input_Source = connexion . request . get_json ( ) input_header_validation ( MQTT_Input_Source ) try : id = utils . create_and_get_ID ( ) dir = os . path . join ( os . getcwd ( ) , "optimization/resources" , str ( id ) ) if not os . path . exists ( dir ) : os . makedirs ( dir ) dir_data = os . path . join ( os . getcwd ( ) , "optimization/resources" , str ( id ) , "mqtt" ) if not os . path . exists ( dir_data ) : os . makedirs ( dir_data ) except Exception as e : logger . error ( e ) path = os . path . join ( os . getcwd ( ) , "optimization/resources" , str ( id ) , "Input.registry.mqtt" ) with open ( path , 'w' ) as outfile : json . dump ( MQTT_Input_Source , outfile , ensure_ascii = False ) logger . info ( "registry/input saved into memory" ) return "Instance created" , 201 , { 'Location' : str ( id ) } except Exception as e : logger . error ( "Invalid data " + str ( e ) ) , 400 return str ( e ) . replace ( "\"" , "" ) else : return 'Data is not in json format' , 400
Creates a new mqtt data source as input
 noqa: E501
Creates a new mqtt data source as input noqa : E501
# noqa: E501 """Creates a new mqtt data source as input

     # noqa: E501

    :param MQTT_Input_Source: Data source to be created
    :type MQTT_Input_Source: dict | bytes

    :rtype: None
    """ # noqa: E501 ####generates an id an makes a directory with the id for the data and for the registry # saves the registry into the new folder # return jsonify({'Data-Source-Id': str(id)})
None
None
MQTT_Input_Source
Data source to be created
Data source to be created