Ejemplo n.º 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'),
}
Ejemplo n.º 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'),
}
Ejemplo n.º 3
0
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'),
}
Ejemplo n.º 4
0
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'),
}
Ejemplo n.º 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'),
}
Ejemplo n.º 6
0
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={},
Ejemplo n.º 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'),
}