Skip to content

Commit

Permalink
[update] 新增ip group
Browse files Browse the repository at this point in the history
  • Loading branch information
comprel committed Jun 11, 2021
1 parent d909530 commit 812eadb
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/api/network/ip_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# coding: utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)

from apps.api.apibase import ApiBase
from apps.api.apibase_backend import ApiBackendBase


class IpGroupBackendApi(ApiBackendBase):
def __init__(self):
super(IpGroupBackendApi, self).__init__()
self.resource_name = "ipaddress_group"
self.resource_workspace = "ipaddress_group"
self._flush_resobj()
self.resource_keys_config = None
25 changes: 25 additions & 0 deletions apps/controller/configer/defines.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,31 @@
'from_port', 'to_port', 'priority', 'nic_type']
}
},
"ipaddress_group": {
"apply": {
"path": "/terraform/v1/network/backend/ip_group/apply",
"method": "POST",
"notnull": ['name', 'provider', "region_id"],
"inputParameters": ['id', 'name', 'secret', 'provider', "addresses", "zone_id", "region_id",
'asset_id', 'extend_info'],
"outputParameters": ["errorMessage", "errorCode", "id", "asset_id"]
},
"destroy": {
"path": "/terraform/v1/network/backend/ip_group/destroy",
"method": "POST",
"notnull": ["id"],
"inputParameters": ["id"],
"outputParameters": ["errorMessage", "errorCode", "id"]
},
"query": {
"path": "/terraform/v1/network/backend/ip_group/source",
"method": "POST",
"notnull": ["region_id", "provider"],
"inputParameters": ["region_id", 'secret', 'provider', 'asset_id', 'name', 'id'],
"outputParameters": ["region_id", 'secret', 'provider', 'asset_id', 'errorMessage', 'errorCode', 'name',
'addresses']
}
},
"nat": {
"apply": {
"path": "/terraform/v1/network/backend/nat/apply",
Expand Down
11 changes: 11 additions & 0 deletions apps/controller/configer/model_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
"ip_protocol",
"ports"
],
"ipaddress_group": [
"name",
"addresses"
],
"nat": [
"name",
"vpc_id",
Expand Down Expand Up @@ -359,6 +363,9 @@
"route_entry": [
"asset_id"
],
"ipaddress_group": [
"asset_id"
],
"security_group": [
"asset_id"
],
Expand Down Expand Up @@ -517,6 +524,10 @@
"asset_id",
"route_table_id"
],
"ipaddress_group": [
"asset_id",
"name",
],
"security_group": [
"asset_id",
"name",
Expand Down
27 changes: 27 additions & 0 deletions apps/controller/network/ip_group_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# _ coding:utf-8 _*_

from __future__ import (absolute_import, division, print_function, unicode_literals)

from apps.api.network.ip_group import IpGroupBackendApi
from apps.controller.backend_controller import BackendAddController
from apps.controller.backend_controller import BackendDeleteController
from apps.controller.backend_controller import BackendSourceController


class IpGroupAddController(BackendAddController):
allow_methods = ("POST",)
resource = IpGroupBackendApi()


class IpGroupDeleteController(BackendDeleteController):
name = "IpGroup"
resource_describe = "IpGroup"
allow_methods = ("POST",)
resource = IpGroupBackendApi()


class IpGroupSourceController(BackendSourceController):
name = "IpGroup"
resource_describe = "IpGroup"
allow_methods = ("POST",)
resource = IpGroupBackendApi()
5 changes: 5 additions & 0 deletions apps/controller/network/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import security_group_controller
import security_group_rule_controller
import peer_connection_controller
import ip_group_controller

from route_entry_controller import RouteEntryController
from route_entry_controller import RouteEntryIdController
Expand All @@ -38,6 +39,10 @@
url(r'^backend/vpc/destroy$', vpc_controller.VPCDeleteController()),
url(r'^backend/vpc/source$', vpc_controller.VPCSourceController()),

url(r'^backend/ip_group/apply$', ip_group_controller.IpGroupAddController()),
url(r'^backend/ip_group/destroy$', ip_group_controller.IpGroupDeleteController()),
url(r'^backend/ip_group/source$', ip_group_controller.IpGroupSourceController()),

url(r'^subnet$', subnet_controller.SubnetController()),
url(r'^subnet/(?P<rid>[\w-]+)$', subnet_controller.SubnetIdController()),
url(r'^backend/subnet/apply$', subnet_controller.SubnetAddController()),
Expand Down

0 comments on commit 812eadb

Please sign in to comment.