{"action":"created","comment":{"url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/comments/59055818","id":59055818,"diff_hunk":"@@ -0,0 +1,35 @@\n+\"\"\"\n+This special file is for keeping track of `models.Manager` classes.\n+TODO:\n+  If this file grows too large to maintain,\n+  create a `managers` folder and split out\n+  files based on class being managed.\n+\"\"\"\n+from core.query import only_current_instances\n+from django.db import models\n+from django.utils import timezone\n+\n+\n+class InstanceActionsManager(models.Manager):\n+\n+    def get_queryset(self):\n+        # Ignores: Terminate, Imaging\n+        instance_actions = [\n+            'Start', 'Stop',\n+            'Resume', 'Suspend',\n+            'Shelve', 'Shelve Offload', 'Unshelve',\n+            'Reboot', 'Hard Reboot',\n+            'Resize', 'Redeploy'","path":"core/models/managers.py","position":22,"original_position":22,"commit_id":"6cd2035838787a52b0f0692eeff35a01ad171acf","original_commit_id":"6cd2035838787a52b0f0692eeff35a01ad171acf","user":{"login":"lenards","id":5923,"avatar_url":"https://avatars.githubusercontent.com/u/5923?v=3","gravatar_id":"","url":"https://api.github.com/users/lenards","html_url":"https://github.com/lenards","followers_url":"https://api.github.com/users/lenards/followers","following_url":"https://api.github.com/users/lenards/following{/other_user}","gists_url":"https://api.github.com/users/lenards/gists{/gist_id}","starred_url":"https://api.github.com/users/lenards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lenards/subscriptions","organizations_url":"https://api.github.com/users/lenards/orgs","repos_url":"https://api.github.com/users/lenards/repos","events_url":"https://api.github.com/users/lenards/events{/privacy}","received_events_url":"https://api.github.com/users/lenards/received_events","type":"User","site_admin":false},"body":"Curious readers might be interested in [server actions list](http://developer.openstack.org/api-guide/compute/server_concepts.html#server-actions) in the OpenStack docs. \r\n\r\nNotably:\r\n> Shelving a server indicates it will not be needed for some time and may be temporarily removed from the hypervisors. This allows its resources to be freed up for use by someone else.","created_at":"2016-04-08T16:55:16Z","updated_at":"2016-04-08T16:55:16Z","html_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere/pull/130#discussion_r59055818","pull_request_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130","_links":{"self":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/comments/59055818"},"html":{"href":"https://github.com/iPlantCollaborativeOpenSource/atmosphere/pull/130#discussion_r59055818"},"pull_request":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130"}}},"pull_request":{"url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130","id":65547937,"html_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere/pull/130","diff_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere/pull/130.diff","patch_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere/pull/130.patch","issue_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/issues/130","number":130,"state":"open","locked":false,"title":"v2 Instance Actions Endpoint","user":{"login":"steve-gregory","id":2889930,"avatar_url":"https://avatars.githubusercontent.com/u/2889930?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-gregory","html_url":"https://github.com/steve-gregory","followers_url":"https://api.github.com/users/steve-gregory/followers","following_url":"https://api.github.com/users/steve-gregory/following{/other_user}","gists_url":"https://api.github.com/users/steve-gregory/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-gregory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-gregory/subscriptions","organizations_url":"https://api.github.com/users/steve-gregory/orgs","repos_url":"https://api.github.com/users/steve-gregory/repos","events_url":"https://api.github.com/users/steve-gregory/events{/privacy}","received_events_url":"https://api.github.com/users/steve-gregory/received_events","type":"User","site_admin":false},"body":"This update includes 'GET' support for `/v2/instances/<id>/action` as well as a new API endpoint: `/v2/instance_actions`.\r\n\r\nHighlight Reel:\r\n\r\n- [x] Give InstanceAction more *POWER*. By utilizing `ProviderInstanceAction`, and the \"last known state\" of an instance, help an API/UI end-user determine what actions are available to them.\r\n- [x] New API Views and Serializers\r\n- [x]  Copy over the logic previously in the UI w.r.t. \"What Actions are available to me\"\r\n- [x] Create new DB migration to give InstanceAction the ability to present a 'name' display that is *different* from the 'key' display that is used to match atmosphere actions! (MOAR Config Management!)\r\n\r\nAlso, some formatting//best practice changes. I couldn't help myself.\r\n- [x] PEP 8\r\n- [x] Move un-necessary things out of api/__init__.py, create new api/decorators.py\r\n- [x] core/models/instance.py was a *beast* - Moved out respective ClassNames to models/instance_[action,status].py\r\n- [x] Replace out-of-band InstanceRelatedField with generic ModelRelatedField\r\n\r\nRef: [Atmo-1246](https://pods.iplantcollaborative.org/jira/browse/ATMO-1246)","created_at":"2016-04-06T22:39:30Z","updated_at":"2016-04-08T16:55:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3148c7cd923c41fce2256b155ceb71fca95914be","assignee":{"login":"lenards","id":5923,"avatar_url":"https://avatars.githubusercontent.com/u/5923?v=3","gravatar_id":"","url":"https://api.github.com/users/lenards","html_url":"https://github.com/lenards","followers_url":"https://api.github.com/users/lenards/followers","following_url":"https://api.github.com/users/lenards/following{/other_user}","gists_url":"https://api.github.com/users/lenards/gists{/gist_id}","starred_url":"https://api.github.com/users/lenards/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lenards/subscriptions","organizations_url":"https://api.github.com/users/lenards/orgs","repos_url":"https://api.github.com/users/lenards/repos","events_url":"https://api.github.com/users/lenards/events{/privacy}","received_events_url":"https://api.github.com/users/lenards/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/milestones/1","html_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere/milestones/nautical-nighthawk","labels_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/milestones/1/labels","id":1686258,"number":1,"title":"nautical-nighthawk","description":null,"creator":{"login":"steve-gregory","id":2889930,"avatar_url":"https://avatars.githubusercontent.com/u/2889930?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-gregory","html_url":"https://github.com/steve-gregory","followers_url":"https://api.github.com/users/steve-gregory/followers","following_url":"https://api.github.com/users/steve-gregory/following{/other_user}","gists_url":"https://api.github.com/users/steve-gregory/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-gregory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-gregory/subscriptions","organizations_url":"https://api.github.com/users/steve-gregory/orgs","repos_url":"https://api.github.com/users/steve-gregory/repos","events_url":"https://api.github.com/users/steve-gregory/events{/privacy}","received_events_url":"https://api.github.com/users/steve-gregory/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2016-04-06T02:08:32Z","updated_at":"2016-04-06T22:39:43Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130/commits","review_comments_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130/comments","review_comment_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/issues/130/comments","statuses_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/statuses/6cd2035838787a52b0f0692eeff35a01ad171acf","head":{"label":"steve-gregory:ATMO-1246-v2-get-actions","ref":"ATMO-1246-v2-get-actions","sha":"6cd2035838787a52b0f0692eeff35a01ad171acf","user":{"login":"steve-gregory","id":2889930,"avatar_url":"https://avatars.githubusercontent.com/u/2889930?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-gregory","html_url":"https://github.com/steve-gregory","followers_url":"https://api.github.com/users/steve-gregory/followers","following_url":"https://api.github.com/users/steve-gregory/following{/other_user}","gists_url":"https://api.github.com/users/steve-gregory/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-gregory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-gregory/subscriptions","organizations_url":"https://api.github.com/users/steve-gregory/orgs","repos_url":"https://api.github.com/users/steve-gregory/repos","events_url":"https://api.github.com/users/steve-gregory/events{/privacy}","received_events_url":"https://api.github.com/users/steve-gregory/received_events","type":"User","site_admin":false},"repo":{"id":52845000,"name":"atmosphere","full_name":"steve-gregory/atmosphere","owner":{"login":"steve-gregory","id":2889930,"avatar_url":"https://avatars.githubusercontent.com/u/2889930?v=3","gravatar_id":"","url":"https://api.github.com/users/steve-gregory","html_url":"https://github.com/steve-gregory","followers_url":"https://api.github.com/users/steve-gregory/followers","following_url":"https://api.github.com/users/steve-gregory/following{/other_user}","gists_url":"https://api.github.com/users/steve-gregory/gists{/gist_id}","starred_url":"https://api.github.com/users/steve-gregory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steve-gregory/subscriptions","organizations_url":"https://api.github.com/users/steve-gregory/orgs","repos_url":"https://api.github.com/users/steve-gregory/repos","events_url":"https://api.github.com/users/steve-gregory/events{/privacy}","received_events_url":"https://api.github.com/users/steve-gregory/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/steve-gregory/atmosphere","description":"Where cloud lives.","fork":true,"url":"https://api.github.com/repos/steve-gregory/atmosphere","forks_url":"https://api.github.com/repos/steve-gregory/atmosphere/forks","keys_url":"https://api.github.com/repos/steve-gregory/atmosphere/keys{/key_id}","collaborators_url":"https://api.github.com/repos/steve-gregory/atmosphere/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/steve-gregory/atmosphere/teams","hooks_url":"https://api.github.com/repos/steve-gregory/atmosphere/hooks","issue_events_url":"https://api.github.com/repos/steve-gregory/atmosphere/issues/events{/number}","events_url":"https://api.github.com/repos/steve-gregory/atmosphere/events","assignees_url":"https://api.github.com/repos/steve-gregory/atmosphere/assignees{/user}","branches_url":"https://api.github.com/repos/steve-gregory/atmosphere/branches{/branch}","tags_url":"https://api.github.com/repos/steve-gregory/atmosphere/tags","blobs_url":"https://api.github.com/repos/steve-gregory/atmosphere/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/steve-gregory/atmosphere/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/steve-gregory/atmosphere/git/refs{/sha}","trees_url":"https://api.github.com/repos/steve-gregory/atmosphere/git/trees{/sha}","statuses_url":"https://api.github.com/repos/steve-gregory/atmosphere/statuses/{sha}","languages_url":"https://api.github.com/repos/steve-gregory/atmosphere/languages","stargazers_url":"https://api.github.com/repos/steve-gregory/atmosphere/stargazers","contributors_url":"https://api.github.com/repos/steve-gregory/atmosphere/contributors","subscribers_url":"https://api.github.com/repos/steve-gregory/atmosphere/subscribers","subscription_url":"https://api.github.com/repos/steve-gregory/atmosphere/subscription","commits_url":"https://api.github.com/repos/steve-gregory/atmosphere/commits{/sha}","git_commits_url":"https://api.github.com/repos/steve-gregory/atmosphere/git/commits{/sha}","comments_url":"https://api.github.com/repos/steve-gregory/atmosphere/comments{/number}","issue_comment_url":"https://api.github.com/repos/steve-gregory/atmosphere/issues/comments{/number}","contents_url":"https://api.github.com/repos/steve-gregory/atmosphere/contents/{+path}","compare_url":"https://api.github.com/repos/steve-gregory/atmosphere/compare/{base}...{head}","merges_url":"https://api.github.com/repos/steve-gregory/atmosphere/merges","archive_url":"https://api.github.com/repos/steve-gregory/atmosphere/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/steve-gregory/atmosphere/downloads","issues_url":"https://api.github.com/repos/steve-gregory/atmosphere/issues{/number}","pulls_url":"https://api.github.com/repos/steve-gregory/atmosphere/pulls{/number}","milestones_url":"https://api.github.com/repos/steve-gregory/atmosphere/milestones{/number}","notifications_url":"https://api.github.com/repos/steve-gregory/atmosphere/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/steve-gregory/atmosphere/labels{/name}","releases_url":"https://api.github.com/repos/steve-gregory/atmosphere/releases{/id}","deployments_url":"https://api.github.com/repos/steve-gregory/atmosphere/deployments","created_at":"2016-03-01T03:26:55Z","updated_at":"2016-03-01T03:26:57Z","pushed_at":"2016-04-07T04:26:57Z","git_url":"git://github.com/steve-gregory/atmosphere.git","ssh_url":"git@github.com:steve-gregory/atmosphere.git","clone_url":"https://github.com/steve-gregory/atmosphere.git","svn_url":"https://github.com/steve-gregory/atmosphere","homepage":"https://atmo.iplantcollaborative.org","size":177176,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"iPlantCollaborativeOpenSource:nautical-nighthawk","ref":"nautical-nighthawk","sha":"a70b996bb61dc259e76b41709360d3fd367fe23a","user":{"login":"iPlantCollaborativeOpenSource","id":669032,"avatar_url":"https://avatars.githubusercontent.com/u/669032?v=3","gravatar_id":"","url":"https://api.github.com/users/iPlantCollaborativeOpenSource","html_url":"https://github.com/iPlantCollaborativeOpenSource","followers_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/followers","following_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/following{/other_user}","gists_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/gists{/gist_id}","starred_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/subscriptions","organizations_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/orgs","repos_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/repos","events_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/events{/privacy}","received_events_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/received_events","type":"Organization","site_admin":false},"repo":{"id":8279795,"name":"atmosphere","full_name":"iPlantCollaborativeOpenSource/atmosphere","owner":{"login":"iPlantCollaborativeOpenSource","id":669032,"avatar_url":"https://avatars.githubusercontent.com/u/669032?v=3","gravatar_id":"","url":"https://api.github.com/users/iPlantCollaborativeOpenSource","html_url":"https://github.com/iPlantCollaborativeOpenSource","followers_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/followers","following_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/following{/other_user}","gists_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/gists{/gist_id}","starred_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/subscriptions","organizations_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/orgs","repos_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/repos","events_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/events{/privacy}","received_events_url":"https://api.github.com/users/iPlantCollaborativeOpenSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere","description":"Where cloud lives.","fork":false,"url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere","forks_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/forks","keys_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/teams","hooks_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/hooks","issue_events_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/issues/events{/number}","events_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/events","assignees_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/assignees{/user}","branches_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/branches{/branch}","tags_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/tags","blobs_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/git/refs{/sha}","trees_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/statuses/{sha}","languages_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/languages","stargazers_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/stargazers","contributors_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/contributors","subscribers_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/subscribers","subscription_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/subscription","commits_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/commits{/sha}","git_commits_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/git/commits{/sha}","comments_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/comments{/number}","issue_comment_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/issues/comments{/number}","contents_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/contents/{+path}","compare_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/merges","archive_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/downloads","issues_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/issues{/number}","pulls_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls{/number}","milestones_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/milestones{/number}","notifications_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/labels{/name}","releases_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/releases{/id}","deployments_url":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/deployments","created_at":"2013-02-18T23:54:07Z","updated_at":"2016-04-04T03:57:20Z","pushed_at":"2016-04-08T00:01:34Z","git_url":"git://github.com/iPlantCollaborativeOpenSource/atmosphere.git","ssh_url":"git@github.com:iPlantCollaborativeOpenSource/atmosphere.git","clone_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere.git","svn_url":"https://github.com/iPlantCollaborativeOpenSource/atmosphere","homepage":"https://atmo.iplantcollaborative.org","size":177200,"stargazers_count":114,"watchers_count":114,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":2,"forks":59,"open_issues":2,"watchers":114,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130"},"html":{"href":"https://github.com/iPlantCollaborativeOpenSource/atmosphere/pull/130"},"issue":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/issues/130"},"comments":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/iPlantCollaborativeOpenSource/atmosphere/statuses/6cd2035838787a52b0f0692eeff35a01ad171acf"}}}}