示例#1
0
import requests

from tasks.core.models import MethodSpec
from tasks import config

ENDPOINT = '/plugins/schema/{name}'

ARGUMENT_HELP = {'name': 'plugin name'}

METHODS = {
    'retrieve':
    MethodSpec(method=requests.get,
               endpoint_params=('name', ),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#retrieve-plugin-schema'),
}
示例#2
0
# name: username or id
# plugin: plugin id
ENDPOINT = '/apis/{name}/plugins/{plugin}'

ARGUMENT_HELP = {
    'name':
    'api name or id',
    'plugin':
    'plugin_id',
    'data': ('json string(e.g \'{"key": "value"}\') '
             'or json payload file path (e.g @payload.json)')
}

METHODS = {
    'list':
    MethodSpec(method=requests.get,
               endpoint_params=('name', ),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#list-plugins-per-api'),
    'create':
    MethodSpec(method=requests.post,
               endpoint_params=('name', ),
               request_data_params={'data': ''},
               doc_url=f'{config.apidoc_url}/#add-plugin'),
    'delete':
    MethodSpec(method=requests.delete,
               endpoint_params=('name', 'plugin'),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#delete-plugin'),
}
示例#3
0
文件: node.py 项目: subicura/kong
import requests

from tasks.core.models import MethodSpec
from tasks import config


ENDPOINT = '/'

METHODS = {
    'information': MethodSpec(
        method=requests.get, endpoint_params=(),
        request_data_params={},
        doc_url=f'{config.apidoc_url}/#retrieve-node-information'),
}
示例#4
0
文件: plugin.py 项目: subicura/kong
import requests

from tasks.core.models import MethodSpec
from tasks import config

# name: username or id
# plugin: plugin id
ENDPOINT = '/plugins/{id}'

ARGUMENT_HELP = {'id': 'plugin uuid'}

METHODS = {
    'list':
    MethodSpec(method=requests.get,
               endpoint_params=(),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#list-all-plugins'),
    'retrieve':
    MethodSpec(method=requests.get,
               endpoint_params=('id', ),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#retrieve-plugin'),
}
示例#5
0
import requests

from tasks.core.models import MethodSpec
from tasks import config

ENDPOINT = '/status'

METHODS = {
    'retrieve':
    MethodSpec(method=requests.get,
               endpoint_params=(),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#retrieve-node-status'),
}
示例#6
0
文件: consumer.py 项目: subicura/kong
from tasks.core.models import MethodSpec
from tasks import config

ENDPOINT = '/consumers/{name}'  # 0: username or id

ARGUMENT_HELP = {
    'name':
    'consumer username or id',
    'data': ('json string(e.g \'{"username": "******"}\') '
             'or json payload file path (e.g @payload.json)')
}

METHODS = {
    'list':
    MethodSpec(method=requests.get,
               endpoint_params=(),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#list-consumers'),
    'retrieve':
    MethodSpec(method=requests.get,
               endpoint_params=('name', ),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#retrieve-consumer'),
    'create':
    MethodSpec(method=requests.post,
               endpoint_params=(),
               request_data_params={'data': ''},
               doc_url=f'{config.apidoc_url}/#create-consumer'),
    'delete':
    MethodSpec(method=requests.delete,
               endpoint_params=('name', ),
               request_data_params={},
示例#7
0
import requests

from tasks.core.models import MethodSpec
from tasks import config

# name: username or id
# plugin: plugin id
ENDPOINT = '/plugins/enabled'

ARGUMENT_HELP = {}

METHODS = {
    'list':
    MethodSpec(method=requests.get,
               endpoint_params=(),
               request_data_params={},
               doc_url=f'{config.apidoc_url}/#retrieve-enabled-plugins'),
}