Views: 10113
Last Modified: 22.09.2017
This script is required to embed provider plugins into Bitrix24 products web-interface.
Presently, the following methods have been realized:
- list - displays the list of all providers, for which sub catalogues exist in the /opt/webdir/providers directory in the appliance:
{
"params": {
"providers": {
"superprovider": {
"status": "enabled"
},
"amazon": {
"error": 1,
"message": "bxProvider::optionsProvider: Provider amazon not exist on the host"
}
}
}
}
In this case, the option is only to enable or disable, as well as to display errors, which occurred during the status query.
If there are no providers available on the host, the list will be empty:
{
"params": {
"providers": {
}
}
}
- status - will show status for provider:
/opt/webdir/bin/bx-provider -a status --provider superprovider -o json
{
"params": {
"provider_options": {
"superprovider": {
"options": {
"order_status": 1,
"order": 1,
"help": 1,
"configs": 1,
"init": 0
},
"status": "enabled",
"files": {
"execute": "/opt/webdir/providers/superprovider/bin/superprovider",
"holder": "/opt/webdir/providers/superprovider",
"config": "/opt/webdir/providers/superprovider/etc/superprovider.conf"
},
"name": "superprovider",
"config": "exists"
}
}
}
}
In this case, internal information is printed (used as is, inside the handler). Basically, such status is more suitable for server operation debugging, rather than for use in web-interface.
- install and uninstall - creates/removes data for provider (Presently, it is more for debugging. Possibly, at a later stage, the hosters would be able to install their own plugin on the server and remove it with the help of these methods):
/opt/webdir/bin/bx-provider -a install --provider amazon --archive /tmp/amazon-v01.tar.gz
- configs - displays the list of all provider configurations:
/opt/webdir/bin/bx-provider -a configs --provider superprovider -o json
{
"params": {
"provider_configs": {
"superprovider": {
"configurations": [
{
"id": "1",
"descr": "Bitrix-env, 1 month, Centos-6 x86_64, CPU 2x1.0 Ghz, Memory 1Gb, HDD 20Gb"
}
],
"status": "enabled"
}
}
}
}
- order - orders virtual server or VPS:
/opt/webdir/bin/bx-provider -a order --provider superprovider --config_id 1 -o json
{
"params": {
"provider_order": {
"superprovider": {
"task_id": "25"
}
}
}
}
- order_status - displays the order status:
/opt/webdir/bin/bx-provider -a order_status --provider superprovider --task_id 25 -o json
{
"params": {
"provider_order": {
"superprovider": {
"server_password": "XXXXXXXXXXXXXXX",
"status": "complete",
"server": "xxx.xxx.xxx.xxx"
"task_id": "25"
}
}
}
}
- orders_list - the list of all orders, executed on the host:
/opt/webdir/bin/bx-provider -a orders_list --provider superprovider -o json
{
"params": {
"provider_order_list": {
"superprovider": {
"25": {
"status": "finished",
"mtime": 1403445981,
"error": 0,
"message": ""
},
"22": {
"status": "error",
"mtime": 1403441000,
"error": 1,
"message": "cannot add ssh key to the server"
},
"21": {
"status": "complete",
"mtime": 1403440979,
"error": 0,
"message": ""
},
"23": {
"status": "finished",
"mtime": 1403441229,
"error": 0,
"message": ""
}
}
}
}
}
One more status is added to the task: complete - it means that the server from this task was added to the pool.
- order_to_host - launches the procedure for adding the server to the pool with parameters, transferred in the order status:
/opt/webdir/bin/bx-provider -a order_to_host --provider superprovider --task_id 25 -o json