mrkaminski / haproxy-client-php
HAProxy DataPlanApi 的 OpenAPI - PHP
dev-master
2020-04-17 18:50 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ~1.12
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ~2.6
This package is auto-updated.
Last update: 2024-09-18 04:23:37 UTC
README
用于编辑和管理 HAProxy 实例的 API。提供进程信息、配置管理、HAProxy 统计和日志。 # 认证
此 PHP 包由 Swagger Codegen 项目自动生成
- API 版本:2.0
- 构建包:io.swagger.codegen.v3.generators.php.PhpClientCodegen 更多信息,请访问 https://my.haproxy.com/portal/cust/login
要求
PHP 5.5 及更高版本
安装与使用
Composer
运行 composer require mrkaminski/haproxy-client-php
手动安装
下载文件并包含 autoload.php
require_once('/path/to/SwaggerClient-php/vendor/autoload.php');
测试
运行单元测试
composer install
./vendor/bin/phpunit
入门
请按照 安装过程 进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure HTTP basic authorization: basic_auth $config = Swagger\Client\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Swagger\Client\Api\ACLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Swagger\Client\Model\Acl(); // \Swagger\Client\Model\Acl | $parent_name = "parent_name_example"; // string | Parent name $parent_type = "parent_type_example"; // string | Parent type $transaction_id = "transaction_id_example"; // string | ID of the transaction where we want to add the operation. Cannot be used when version is specified. $version = 56; // int | Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. $force_reload = false; // bool | If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. try { $result = $apiInstance->createAcl($body, $parent_name, $parent_type, $transaction_id, $version, $force_reload); print_r($result); } catch (Exception $e) { echo 'Exception when calling ACLApi->createAcl: ', $e->getMessage(), PHP_EOL; } // Configure HTTP basic authorization: basic_auth $config = Swagger\Client\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Swagger\Client\Api\ACLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = 56; // int | ACL line ID $parent_name = "parent_name_example"; // string | Parent name $parent_type = "parent_type_example"; // string | Parent type $transaction_id = "transaction_id_example"; // string | ID of the transaction where we want to add the operation. Cannot be used when version is specified. $version = 56; // int | Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. $force_reload = false; // bool | If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. try { $apiInstance->deleteAcl($id, $parent_name, $parent_type, $transaction_id, $version, $force_reload); } catch (Exception $e) { echo 'Exception when calling ACLApi->deleteAcl: ', $e->getMessage(), PHP_EOL; } // Configure HTTP basic authorization: basic_auth $config = Swagger\Client\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Swagger\Client\Api\ACLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = 56; // int | ACL line ID $parent_name = "parent_name_example"; // string | Parent name $parent_type = "parent_type_example"; // string | Parent type $transaction_id = "transaction_id_example"; // string | ID of the transaction where we want to add the operation. Cannot be used when version is specified. try { $result = $apiInstance->getAcl($id, $parent_name, $parent_type, $transaction_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ACLApi->getAcl: ', $e->getMessage(), PHP_EOL; } // Configure HTTP basic authorization: basic_auth $config = Swagger\Client\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Swagger\Client\Api\ACLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $parent_name = "parent_name_example"; // string | Parent name $parent_type = "parent_type_example"; // string | Parent type $transaction_id = "transaction_id_example"; // string | ID of the transaction where we want to add the operation. Cannot be used when version is specified. try { $result = $apiInstance->getAcls($parent_name, $parent_type, $transaction_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ACLApi->getAcls: ', $e->getMessage(), PHP_EOL; } // Configure HTTP basic authorization: basic_auth $config = Swagger\Client\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Swagger\Client\Api\ACLApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Swagger\Client\Model\Acl(); // \Swagger\Client\Model\Acl | $parent_name = "parent_name_example"; // string | Parent name $parent_type = "parent_type_example"; // string | Parent type $id = 56; // int | ACL line ID $transaction_id = "transaction_id_example"; // string | ID of the transaction where we want to add the operation. Cannot be used when version is specified. $version = 56; // int | Version used for checking configuration version. Cannot be used when transaction is specified, transaction has it's own version. $force_reload = false; // bool | If set, do a force reload, do not wait for the configured reload-delay. Cannot be used when transaction is specified, as changes in transaction are not applied directly to configuration. try { $result = $apiInstance->replaceAcl($body, $parent_name, $parent_type, $id, $transaction_id, $version, $force_reload); print_r($result); } catch (Exception $e) { echo 'Exception when calling ACLApi->replaceAcl: ', $e->getMessage(), PHP_EOL; } ?>
API 端点文档
所有 URI 都是相对于 /v2
模型文档
- Acl
- Acls
- Backend
- BackendHashType
- BackendStickTable
- BackendSwitchingRule
- BackendSwitchingRules
- Backends
- Balance
- Bind
- Binds
- Cookie
- DefaultServer
- Defaults
- Endpoint
- Endpoints
- Error
- Errorfile
- Filter
- Filters
- Forwardfor
- Frontend
- Frontends
- GlobalCpuMaps
- GlobalRuntimeApis
- HttpRequestRule
- HttpRequestRules
- HttpResponseRule
- HttpResponseRules
- Httpchk
- Info
- InfoApi
- InfoSystem
- InfoSystemCpuInfo
- InfoSystemMemInfo
- InlineResponse200
- InlineResponse2001
- InlineResponse20010
- InlineResponse20011
- InlineResponse20012
- InlineResponse20013
- InlineResponse20014
- InlineResponse20015
- InlineResponse20016
- InlineResponse20017
- InlineResponse20018
- InlineResponse20019
- InlineResponse2002
- InlineResponse20020
- InlineResponse20021
- InlineResponse20022
- InlineResponse20023
- InlineResponse20024
- InlineResponse20025
- InlineResponse20026
- InlineResponse20027
- InlineResponse20028
- InlineResponse20029
- InlineResponse2003
- InlineResponse20030
- InlineResponse20031
- InlineResponse20032
- InlineResponse2004
- InlineResponse2005
- InlineResponse2006
- InlineResponse2007
- InlineResponse2008
- InlineResponse2009
- LogTarget
- LogTargets
- ModelGlobal
- NativeStat
- NativeStatStats
- NativeStats
- ProcessInfos
- ProcessInfosInner
- Redispatch
- Reload
- Reloads
- RuntimeServer
- RuntimeServers
- Server
- ServerSwitchingRule
- ServerSwitchingRules
- Servers
- Site
- SiteFarms
- SiteService
- Sites
- StatsCollection
- StickRule
- StickRules
- StickTable
- StickTableEntries
- StickTableEntry
- StickTableFields
- StickTables
- TcpRequestRule
- TcpRequestRules
- TcpResponseRule
- TcpResponseRules
- Transaction
- Transactions
授权文档
basic_auth
- 类型:HTTP 基本认证