{"action":"created","comment":{"url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/comments/52306047","id":52306047,"diff_hunk":"@@ -0,0 +1,193 @@\n+#!/usr/bin/env python\n+# -*- encoding: utf-8 -*-\n+#\n+# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U\n+#\n+# This file is part of FI-WARE project.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+#\n+# You may obtain a copy of the License at:\n+#\n+#        http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+#\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+# For those usages not covered by the Apache version 2.0 License please\n+# contact with opensource@tid.es\n+#\n+\n+# Import flask dependencies\n+from flask import Blueprint, abort, make_response\n+import httplib\n+\n+# Import the database object from the main app module\n+from app import db\n+\n+# Import module models (i.e. User)\n+from models import User\n+\n+# Import authentication decorator\n+from openstack_auth import authorized\n+\n+# Import region manage decorator\n+from region_manager import check_region\n+\n+from app.settings.settings import CONTENT_TYPE, SERVER_HEADER, SERVER, JSON_TYPE\n+from app.mod_auth.models import Images, Task\n+from app.settings.log import logger\n+\n+__author__ = 'fla'\n+\n+# Define the blueprint: 'auth', set its url prefix: app.url/regions\n+mod_auth = Blueprint('auth', __name__, url_prefix='/regions')\n+\n+\n+# Set the route and accepted methods\n+@mod_auth.route('/<regionid>', methods=['GET'])\n+@authorized\n+@check_region\n+def get_status(regionid, token=None):\n+    \"\"\"\n+    Lists information the status of the synchronization of the images in\n+    the region <regionid>. Keep in mind that <regionid> is the name of\n+    the region.\n+    :param regionid: Region name how you can obtain from the Keystone\n+                     service. Example: Spain2.\n+    :return: JSON response message with the detailed information about\n+             the images and the sincronization status.\n+    \"\"\"\n+\n+    message = \"GET, get information about the synchronization status in the region: {}\".format(regionid)\n+\n+    logger.info(message)\n+\n+    # Just for check this data should be returned by glancesync client\n+    x = Images()\n+\n+    value = ['3cfeaf3f0103b9637bb3fcfe691fce1e', 'base_ubuntu_14.04', 'ok', None]\n+    x.add(value)\n+\n+    value = ['4rds4f3f0103b9637bb3fcfe691fce1e', 'base_centOS_7', 'ok', None]\n+    x.add(value)\n+\n+    resp = make_response(x.dump(), httplib.OK)\n+    resp.headers[SERVER_HEADER] = SERVER\n+    resp.headers[CONTENT_TYPE] = JSON_TYPE\n+\n+    return resp\n+\n+\n+@mod_auth.route('/<regionid>', methods=['POST'])\n+@authorized\n+@check_region\n+def synchronize(regionid, token=None):\n+    \"\"\"\n+    Synchronize the images of the corresponding region defined by its regionId.\n+    The operation is asynchronous a response a taskId in order that you can follow\n+    the execution of the process.\n+    :param regionid: Region name how you can obtain from the Keystone\n+                     service. Example: Spain2.\n+    :return: JSON message with the identification of the created task\n+    \"\"\"\n+    # WARNING\n+    # It is for testing only, the functionality of this method is create a new Task,\n+    # store the content of the new task with <taskid> in DB with status 'syncing'\n+    # and launch a fork to start the execution of the synchronization process. At the\n+    # end of the synchronization process, we update the DB registry with the status\n+    # 'synced'\n+    message = \"POST, create a new synchronization task in the region: {}\".format(regionid)\n+\n+    logger.info(message)\n+\n+    newtask = Task(status='syncing')\n+\n+    # name and role should be returned from authorized operation, to be extended in Sprint 16.02\n+    newuser = User(region=regionid, name=token.username, taskid=str(newtask.taskid),\n+                   role='admin', status=newtask.status)\n+\n+    db.session.add(newuser)\n+    db.session.commit()\n+\n+    resp = make_response(newtask.dump(), httplib.OK)\n+    resp.headers[SERVER_HEADER] = SERVER\n+    resp.headers[CONTENT_TYPE] = JSON_TYPE\n+\n+    return resp\n+\n+\n+@mod_auth.route('/<regionid>/tasks/<taskid>', methods=['GET'])\n+@authorized\n+@check_region\n+def get_task(regionid, taskid, token=None):\n+    \"\"\"\n+\n+    :param regionid:\n+    :param taskid:\n+    :return:\n+    \"\"\"","path":"app/mod_auth/controllers.py","position":134,"original_position":134,"commit_id":"a014301798604091246455333a6dcfa6f562525f","original_commit_id":"a014301798604091246455333a6dcfa6f562525f","user":{"login":"pratid","id":2345596,"avatar_url":"https://avatars.githubusercontent.com/u/2345596?v=3","gravatar_id":"","url":"https://api.github.com/users/pratid","html_url":"https://github.com/pratid","followers_url":"https://api.github.com/users/pratid/followers","following_url":"https://api.github.com/users/pratid/following{/other_user}","gists_url":"https://api.github.com/users/pratid/gists{/gist_id}","starred_url":"https://api.github.com/users/pratid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pratid/subscriptions","organizations_url":"https://api.github.com/users/pratid/orgs","repos_url":"https://api.github.com/users/pratid/repos","events_url":"https://api.github.com/users/pratid/events{/privacy}","received_events_url":"https://api.github.com/users/pratid/received_events","type":"User","site_admin":false},"body":"This documentation with blank descriptions does not provide helpful additional information...","created_at":"2016-02-09T13:23:30Z","updated_at":"2016-02-09T13:23:30Z","html_url":"https://github.com/telefonicaid/fiware-glancesync/pull/60#discussion_r52306047","pull_request_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60","_links":{"self":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/comments/52306047"},"html":{"href":"https://github.com/telefonicaid/fiware-glancesync/pull/60#discussion_r52306047"},"pull_request":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60"}}},"pull_request":{"url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60","id":58727812,"html_url":"https://github.com/telefonicaid/fiware-glancesync/pull/60","diff_url":"https://github.com/telefonicaid/fiware-glancesync/pull/60.diff","patch_url":"https://github.com/telefonicaid/fiware-glancesync/pull/60.patch","issue_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/60","number":60,"state":"open","locked":false,"title":"Feature/5635 glancesync api implementation","user":{"login":"flopezag","id":1379796,"avatar_url":"https://avatars.githubusercontent.com/u/1379796?v=3","gravatar_id":"","url":"https://api.github.com/users/flopezag","html_url":"https://github.com/flopezag","followers_url":"https://api.github.com/users/flopezag/followers","following_url":"https://api.github.com/users/flopezag/following{/other_user}","gists_url":"https://api.github.com/users/flopezag/gists{/gist_id}","starred_url":"https://api.github.com/users/flopezag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flopezag/subscriptions","organizations_url":"https://api.github.com/users/flopezag/orgs","repos_url":"https://api.github.com/users/flopezag/repos","events_url":"https://api.github.com/users/flopezag/events{/privacy}","received_events_url":"https://api.github.com/users/flopezag/received_events","type":"User","site_admin":false},"body":"#### REVIEWERS\r\n@chemaper @pratid @jicarretero \r\n\r\n#### DESCRIPTION\r\nATENTION, DO NOT MERGE THIS PR, IT IS IN PROGRESS, IT IS JUST TO START THE REVIEW PROCESS OF THIS BIG PR...\r\n- Implementation of the GlanceSync API.\r\n- Correction of some Acceptance Tests problems.\r\n- Unit Tests associated to the GlanceSync API.\r\n\r\n#### TESTING\r\nLocally","created_at":"2016-02-09T10:21:21Z","updated_at":"2016-02-09T13:23:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18cfe0232e2645c0578b9d39f9f524dc86abe671","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60/commits","review_comments_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60/comments","review_comment_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/comments{/number}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/60/comments","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/statuses/a014301798604091246455333a6dcfa6f562525f","head":{"label":"telefonicaid:feature/5635_glancesync_api","ref":"feature/5635_glancesync_api","sha":"a014301798604091246455333a6dcfa6f562525f","user":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"repo":{"id":39255854,"name":"fiware-glancesync","full_name":"telefonicaid/fiware-glancesync","owner":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telefonicaid/fiware-glancesync","description":"","fork":false,"url":"https://api.github.com/repos/telefonicaid/fiware-glancesync","forks_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/forks","keys_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/teams","hooks_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/hooks","issue_events_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/events{/number}","events_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/events","assignees_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/assignees{/user}","branches_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/branches{/branch}","tags_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/tags","blobs_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/refs{/sha}","trees_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/statuses/{sha}","languages_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/languages","stargazers_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/stargazers","contributors_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/contributors","subscribers_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/subscribers","subscription_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/subscription","commits_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/commits{/sha}","git_commits_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/commits{/sha}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/comments{/number}","issue_comment_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/comments{/number}","contents_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/contents/{+path}","compare_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/merges","archive_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/downloads","issues_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues{/number}","pulls_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls{/number}","milestones_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/milestones{/number}","notifications_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/labels{/name}","releases_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/releases{/id}","deployments_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/deployments","created_at":"2015-07-17T13:38:48Z","updated_at":"2016-01-20T10:36:58Z","pushed_at":"2016-02-09T10:57:01Z","git_url":"git://github.com/telefonicaid/fiware-glancesync.git","ssh_url":"git@github.com:telefonicaid/fiware-glancesync.git","clone_url":"https://github.com/telefonicaid/fiware-glancesync.git","svn_url":"https://github.com/telefonicaid/fiware-glancesync","homepage":null,"size":30277,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"telefonicaid:develop","ref":"develop","sha":"58c115a55ee2af212674d7e1d36878bd1be229e7","user":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"repo":{"id":39255854,"name":"fiware-glancesync","full_name":"telefonicaid/fiware-glancesync","owner":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telefonicaid/fiware-glancesync","description":"","fork":false,"url":"https://api.github.com/repos/telefonicaid/fiware-glancesync","forks_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/forks","keys_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/teams","hooks_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/hooks","issue_events_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/events{/number}","events_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/events","assignees_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/assignees{/user}","branches_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/branches{/branch}","tags_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/tags","blobs_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/refs{/sha}","trees_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/statuses/{sha}","languages_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/languages","stargazers_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/stargazers","contributors_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/contributors","subscribers_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/subscribers","subscription_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/subscription","commits_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/commits{/sha}","git_commits_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/git/commits{/sha}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/comments{/number}","issue_comment_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/comments{/number}","contents_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/contents/{+path}","compare_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/merges","archive_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/downloads","issues_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues{/number}","pulls_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls{/number}","milestones_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/milestones{/number}","notifications_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/labels{/name}","releases_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/releases{/id}","deployments_url":"https://api.github.com/repos/telefonicaid/fiware-glancesync/deployments","created_at":"2015-07-17T13:38:48Z","updated_at":"2016-01-20T10:36:58Z","pushed_at":"2016-02-09T10:57:01Z","git_url":"git://github.com/telefonicaid/fiware-glancesync.git","ssh_url":"git@github.com:telefonicaid/fiware-glancesync.git","clone_url":"https://github.com/telefonicaid/fiware-glancesync.git","svn_url":"https://github.com/telefonicaid/fiware-glancesync","homepage":null,"size":30277,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60"},"html":{"href":"https://github.com/telefonicaid/fiware-glancesync/pull/60"},"issue":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/60"},"comments":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/issues/60/comments"},"review_comments":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60/comments"},"review_comment":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/pulls/60/commits"},"statuses":{"href":"https://api.github.com/repos/telefonicaid/fiware-glancesync/statuses/a014301798604091246455333a6dcfa6f562525f"}}}}