Giter Site home page Giter Site logo

connections-manager's Introduction

Connections manager

Connections manager is a service which controls connections to a resource.

Installation

Build the Docker image from the Dockerfile:

docker build -t connections-manager .

Run with mapping of port 7080 in the container to port 7080 on the Docker host:

docker run -dp 7080:7080 connections-manager

Usage

In order to ask for a resource send a GET request to:

http://0.0.0.0:7080/

On success a resource will be returned in the given format:

{
  "ip": "<resource_ip>",
  "username": "<username>",
  "password": "<password>"
}

In order to release a resource send a POST request to:

http://0.0.0.0:7080/

with body in the given format:

{
  "ip": "<resource_ip>"
}

On success the same json will be returned.

Error Handling

In the case of one of the following:

  • Any request not in one of the formats defined above
  • GET request while all the resources are already taken
  • POST request in which a free resource is asked to be released

'400 Bad Request' HTTP response will be returned.

Resources Database

On the first run of the program a resource pool database will be created, and will be initialized with 20 random resources. The resulting behaviour will be that in the case that the program stops and then runs again, the resources will be in the same state (locked or free) as before. In order to reset the resources data, the db file

'/resources_pool.db'

has to be deleted.

connections-manager's People

Contributors

bayerasif avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.