Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c7fbfc51
authored
2 years ago
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial setup for rest api - IaC
parent
796da6b9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
2 deletions
+31
-2
circle/circle/settings/base.py
+1
-0
circle/circle/urls.py
+3
-1
circle/dashboard/urls.py
+3
-1
circle/dashboard/views/vm.py
+24
-0
No files found.
circle/circle/settings/base.py
View file @
c7fbfc51
...
...
@@ -379,6 +379,7 @@ THIRD_PARTY_APPS = (
'statici18n'
,
'simplesshkey'
,
'pipeline'
,
'rest_framework'
,
)
...
...
This diff is collapsed.
Click to expand it.
circle/circle/urls.py
View file @
c7fbfc51
...
...
@@ -20,7 +20,7 @@ from django.views.generic import TemplateView
from
django.conf
import
settings
from
django.contrib
import
admin
from
django.urls
import
reverse
from
django.urls
import
reverse
,
path
from
django.shortcuts
import
redirect
from
django.contrib.auth.views
import
(
PasswordResetView
,
PasswordResetConfirmView
...
...
@@ -71,6 +71,8 @@ urlpatterns = [
name
=
"info.support"
),
url
(
r'^info/resize-how-to/$'
,
ResizeHelpView
.
as_view
(),
name
=
"info.resize"
),
path
(
'api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
))
]
if
'rosetta'
in
settings
.
INSTALLED_APPS
:
...
...
This diff is collapsed.
Click to expand it.
circle/dashboard/urls.py
View file @
c7fbfc51
...
...
@@ -18,6 +18,7 @@
from
django.conf.urls
import
url
from
django.urls
import
path
from
vm.models
import
Instance
from
.views
import
(
...
...
@@ -58,12 +59,13 @@ from .views import (
MessageList
,
MessageDetail
,
MessageCreate
,
MessageDelete
,
EnableTwoFactorView
,
DisableTwoFactorView
,
AclUserGroupAutocomplete
,
AclUserAutocomplete
,
RescheduleView
,
GroupImportView
,
GroupExportView
RescheduleView
,
GroupImportView
,
GroupExportView
,
iac_vm_list
)
from
.views.node
import
node_ops
from
.views.vm
import
vm_ops
,
vm_mass_ops
urlpatterns
=
[
path
(
'acpi/list'
,
iac_vm_list
),
url
(
r'^$'
,
IndexView
.
as_view
(),
name
=
"dashboard.index"
),
url
(
r"^profile/list/$"
,
UserList
.
as_view
(),
name
=
"dashboard.views.user-list"
),
...
...
This diff is collapsed.
Click to expand it.
circle/dashboard/views/vm.py
View file @
c7fbfc51
...
...
@@ -20,6 +20,7 @@ import json
import
logging
from
collections
import
OrderedDict
from
os
import
getenv
from
urllib
import
response
from
django.conf
import
settings
from
django.contrib
import
messages
...
...
@@ -86,6 +87,29 @@ except NameError:
logger
=
logging
.
getLogger
(
__name__
)
from
rest_framework
import
status
from
rest_framework.decorators
import
api_view
,
authentication_classes
,
permission_classes
from
rest_framework.response
import
Response
from
rest_framework.authentication
import
SessionAuthentication
,
BasicAuthentication
from
rest_framework.permissions
import
IsAdminUser
@api_view
([
'GET'
])
@authentication_classes
([
SessionAuthentication
,
BasicAuthentication
])
@permission_classes
([
IsAdminUser
])
def
iac_vm_list
(
request
):
instances
=
Instance
.
objects
.
all
()
instances
=
[{
'pk'
:
i
.
pk
,
'url'
:
reverse
(
'dashboard.views.detail'
,
args
=
[
i
.
pk
]),
'name'
:
i
.
name
,
'icon'
:
i
.
get_status_icon
(),
'host'
:
i
.
short_hostname
,
'status'
:
i
.
get_status_display
(),
'owner'
:
(
i
.
owner
.
profile
.
get_display_name
()),
}
for
i
in
instances
]
return
Response
(
instances
)
class
VmDetailVncTokenView
(
CheckedDetailView
):
template_name
=
"dashboard/vm-detail.html"
model
=
Instance
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment