-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename to rebrand tunel to another project
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
295 additions
and
292 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,66 @@ | ||
from flask_restful import Resource, Api | ||
from singularity.cli import Singularity | ||
from utils import ( | ||
get_container_links, | ||
get_container_args, | ||
get_container_labels | ||
) | ||
from utils import get_container_links, get_container_args, get_container_labels | ||
|
||
from . import app | ||
|
||
api = Api(app) | ||
|
||
|
||
class apiContainers(Resource): | ||
'''apiContainers | ||
"""apiContainers | ||
Main view for REST API to display all available containers | ||
''' | ||
""" | ||
|
||
def get(self): | ||
# Generate the url list for each container | ||
response = {} | ||
for cname,cpath in app.containers: | ||
response[cname] = url_for('.api_container',cname) | ||
for cname, cpath in app.containers: | ||
response[cname] = url_for(".api_container", cname) | ||
return response | ||
|
||
|
||
class apiContainerArgs(Resource): | ||
'''apiContainerArgs | ||
''' | ||
"""apiContainerArgs""" | ||
|
||
def get(self, name): | ||
if name in app.containers: | ||
image_path = app.containers[name] | ||
return get_container_args(image_path,cli=app.cli) | ||
return get_container_args(image_path, cli=app.cli) | ||
else: | ||
return {'error':'Not Found'} | ||
return {"error": "Not Found"} | ||
|
||
|
||
class apiContainerLabels(Resource): | ||
'''apiContainerLabels | ||
''' | ||
"""apiContainerLabels""" | ||
|
||
def get(self, name): | ||
if name in app.containers: | ||
image_path = app.containers[name] | ||
return get_container_labels(image_path,cli=app.cli) | ||
return get_container_labels(image_path, cli=app.cli) | ||
else: | ||
return {'error':'Not Found'} | ||
return {"error": "Not Found"} | ||
|
||
|
||
class apiContainer(Resource): | ||
'''apiContainer | ||
display metadata and endpoints for a container | ||
''' | ||
"""apiContainer | ||
display metadata and endpoints for a container | ||
""" | ||
|
||
def get(self, name): | ||
if name in app.containers: | ||
response = dict() | ||
image_path = app.containers[name] | ||
response['links'] = get_container_links(name) | ||
response['args'] = get_container_args(image_path,cli=app.cli) | ||
response['labels'] = get_container_labels(image_path,cli=app.cli) | ||
response['name'] = name | ||
response["links"] = get_container_links(name) | ||
response["args"] = get_container_args(image_path, cli=app.cli) | ||
response["labels"] = get_container_labels(image_path, cli=app.cli) | ||
response["name"] = name | ||
return response | ||
else: | ||
return {'error':'Not Found'} | ||
return {"error": "Not Found"} | ||
|
||
|
||
|
||
api.add_resource(apiContainers,'/api/containers') | ||
api.add_resource(apiContainer,'/api/container/<string:name>') | ||
api.add_resource(apiContainerArgs,'/api/container/args/<string:name>') | ||
api.add_resource(apiContainerLabels,'/api/container/labels/<string:name>') | ||
api.add_resource(apiContainers, "/api/containers") | ||
api.add_resource(apiContainer, "/api/container/<string:name>") | ||
api.add_resource(apiContainerArgs, "/api/container/args/<string:name>") | ||
api.add_resource(apiContainerLabels, "/api/container/labels/<string:name>") |
This file contains 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
Oops, something went wrong.