Views: 7457
Last Modified: 22.09.2017

All work with providers is carried out via plugins, located in the specific catalogue (presently, all management is file-based): /opt/webdir/providers.

The following is specified for each provider:

  • command line mandatory parameters to universalize the access to their capabilities;
  • standartized output upon completion of results processing.

Plugin script, to be used in web-interface of Bitrix24 products shall be located at the address:

/opt/webdir/providers/{provider_name}/bin/{provider_name}

To be connected to the pool, provider's plugin shall support the following command line arguments:

  • help - displays supported command line arguments:
    {
      "options": [
        "help",
        "configs",
        "order",
        "order_status"
      ],
      "status": "enabled"
    }
    

    options array shall contain the list of supported options (for example, the init option is missing in this case. It allows connecting at the stage of master server creation wizard).

    status option can contain the following values: disabled or enabled, which allow to determine whether the provider is enabled or not on a specific server.

  • configs - displays the list of supported configurations:
    {
      "configurations": [
        {
          "id": "1",
          "descr": "Bitrix-env, 1 month, Centos-6 x86_64, CPU 2x1.0 Ghz, Memory 1Gb, HDD 20Gb"
        }
      ],
      "status": "enabled"
    }
    

    configurations - contains the list of services/configrations, which user can order, using Bitrix web-interface.

    At the present moment, two parameters for each configuration are supported:

    • id - configuration identifier, which will be used during the order,
    • descr - description for user.
  • order - allows to indicate the server/VPS for selected configuration. In this case, the configuration number will transferred via the second parameter:
    {"task_id":"24"}
    

    task_id should contain task number, used for further polling and start of adding the appliance upon completion.

  • order_status - allows to receive information about an order:
    {
      "server_password": "XXXXXXXXXXXXXX",
      "status": "finished",
      "server": "xxx.xxx.xxx.xxx",
      "task_id": "24"
    }
    
    where:
    • status - contains Information about the order, may contain the following values:
      • in_progress - is in processing from the side of provider/hoster;
      • finished - processing is complete, appliance can be added to the pool;
      • error - error occurred during completion.
    • server - contains IP-address or appliance name;
    • server_password - contains root user password for ssh-keys copying during server connection to the pool.

    Any of the actions can inform about the error via the error and error_message field values. For example:

    {
      "error_message": "get_task error N102, No task found",
      "error": 1
    }
    

Attention! For information about operation of the script, which uses the provider capacities and allows to connect them into web-interface, see Script to Work with Providers.





Courses developed by Bitrix24