Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
4ac6ad22
Commit
4ac6ad22
authored
May 29, 2019
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused codes
parent
1db3b802
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
api/urls.py
api/urls.py
+4
-4
api/utils.py
api/utils.py
+6
-2
api/views.py
api/views.py
+1
-5
No files found.
api/urls.py
View file @
4ac6ad22
from
api.viewsets.applications
import
ApplicationViewSet
,
GroupDependentViewSet
from
api.viewsets.services
import
APIServiceViewSet
from
api.viewsets.endpoints
import
APIEndpointViewSet
from
django.urls
import
path
,
include
from
rest_framework.routers
import
DefaultRouter
,
SimpleRouter
from
rest_framework.routers
import
DefaultRouter
from
api.viewsets.services
import
APIServiceViewSet
from
api.viewsets.endpoints
import
APIEndpointViewSet
from
api.viewsets.applications
import
ApplicationViewSet
,
GroupDependentViewSet
from
api.views
import
(
APIGatewayList
,
APIGatewaySlugDetail
,
APIGatewaySlugModelDetail
)
...
...
api/utils.py
View file @
4ac6ad22
...
...
@@ -9,6 +9,7 @@ from .models import APIEndpoint
from
rest_framework.pagination
import
PageNumberPagination
from
rest_framework.response
import
Response
import
datetime
from
functools
import
wraps
VALIDATE_TOKEN_URL
=
settings
.
VALIDATE_TOKEN_URL
...
...
@@ -90,18 +91,22 @@ class Helper:
service__name
=
service
,
endpoint_url
=
endpoint_url
,
)
if
endpoint
.
is_active
is
True
:
base_url
=
endpoint
.
service
.
base_url
full_path
=
request
.
get_full_path
()
final_endpoint
=
f
"{base_url}{full_path}"
if
endpoint
.
is_need_auth
is
True
:
# redirect to authenticator service
self
.
_headers
=
{
'Authorization'
:
request
.
META
[
'HTTP_AUTHORIZATION'
],
"endpoint"
:
endpoint
.
endpoint_url
'Content-Type'
:
'application/json'
,
"endpoint"
:
str
(
endpoint
.
id
)
}
req
=
requests
.
post
(
VALIDATE_TOKEN_URL
,
headers
=
self
.
_headers
)
print
(
req
)
all_headers
=
{
**
req
.
headers
,
**
self
.
_headers
}
if
req
.
status_code
==
200
:
...
...
@@ -156,7 +161,6 @@ def number_generator(prefix, id):
# status message
def
status_message_response
(
code
,
status
,
message
,
results
):
print
(
'ddd'
)
message
=
{
'code'
:
code
,
'status'
:
status
,
...
...
api/views.py
View file @
4ac6ad22
from
rest_framework
import
viewsets
,
status
from
rest_framework.views
import
APIView
from
rest_framework.decorators
import
action
from
rest_framework.response
import
Response
from
django_filters.rest_framework
import
DjangoFilterBackend
from
.models
import
APIService
,
APIEndpoint
,
Application
from
.utils
import
(
APIEndpointFilter
,
Helper
)
from
.utils
import
Helper
class
APIGatewayList
(
APIView
):
...
...
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