carlo/apollo_client

apollo-open-api php版阿波罗第三方平台接入sdk PHP Apollo third-party platform access SDK

v1.0.2 2022-04-11 17:10 UTC

This package is auto-updated.

Last update: 2024-09-11 14:23:10 UTC


README

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: v0.0.2
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称
$key = "key_example"; // string | 字段名
$operator = "operator_example"; // string | 删除配置的操作者,域账号

try {
    $apiInstance->deleteField($app_id, $env, $cluster_name, $namespace_name, $key, $operator);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->deleteField: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);

try {
    $result = $apiInstance->getAppInfo();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getAppInfo: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称

try {
    $result = $apiInstance->getClusters($app_id, $env, $cluster_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getClusters: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id

try {
    $result = $apiInstance->getEnvClustersById($app_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getEnvClustersById: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称
$key = "key_example"; // string | 字段名

try {
    $result = $apiInstance->getField($app_id, $env, $cluster_name, $namespace_name, $key);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getField: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称

try {
    $result = $apiInstance->getLock($app_id, $env, $cluster_name, $namespace_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getLock: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称

try {
    $result = $apiInstance->getNamespace($app_id, $env, $cluster_name, $namespace_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getNamespace: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称

try {
    $result = $apiInstance->getNamespaces($app_id, $env, $cluster_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getNamespaces: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称

try {
    $result = $apiInstance->getReleases($app_id, $env, $cluster_name, $namespace_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getReleases: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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\ClusterInfoBase(); // \Swagger\Client\Model\ClusterInfoBase | post携带参数
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境

try {
    $result = $apiInstance->postClusters($body, $app_id, $env);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->postClusters: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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\FieldBase(); // \Swagger\Client\Model\FieldBase | post携带参数
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称

try {
    $result = $apiInstance->postField($body, $app_id, $env, $cluster_name, $namespace_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->postField: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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\NamespaceBase(); // \Swagger\Client\Model\NamespaceBase | post携带参数
$app_id = "app_id_example"; // string | 应用id

try {
    $result = $apiInstance->postNamespace($body, $app_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->postNamespace: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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\ReleasesPost(); // \Swagger\Client\Model\ReleasesPost | post携带参数
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称

try {
    $result = $apiInstance->postReleases($body, $app_id, $env, $cluster_name, $namespace_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->postReleases: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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\FieldPut(); // \Swagger\Client\Model\FieldPut | 携带参数
$app_id = "app_id_example"; // string | 应用id
$env = "env_example"; // string | 环境
$cluster_name = "cluster_name_example"; // string | 集群名称
$namespace_name = "namespace_name_example"; // string | 命名空间名称
$key = "key_example"; // string | 字段名
$create_if_not_exists = true; // bool | 当配置不存在时是否自动创建

try {
    $apiInstance->putField($body, $app_id, $env, $cluster_name, $namespace_name, $key, $create_if_not_exists);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->putField: ', $e->getMessage(), PHP_EOL;
}

// Configure API key authorization: ApiKeyAuth
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Swagger\Client\Api\DefaultApi(
    // 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
);
$operator = "operator_example"; // string | 删除配置的操作者,域账号
$release_id = "release_id_example"; // string | 发布记录id
$env = "env_example"; // string | 环境

try {
    $result = $apiInstance->rollback($operator, $release_id, $env);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->rollback: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to http://config-admin.test.huajiao.com/openapi/v1

ClassMethodHTTP requestDescription
DefaultApideleteFieldDELETE /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key}删除配置接口
DefaultApigetAppInfoGET /apps获取App信息
DefaultApigetClustersGET /envs/{env}/apps/{appId}/clusters/{clusterName}获取集群接口
DefaultApigetEnvClustersByIdGET /apps/{appId}/envclusters获取App的环境,集群信息
DefaultApigetFieldGET /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key}读取配置接口
DefaultApigetLockGET /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/lock获取某个Namespace当前编辑人接口
DefaultApigetNamespaceGET /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}获取某个Namespace信息接口
DefaultApigetNamespacesGET /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces获取集群下所有Namespace信息接口
DefaultApigetReleasesGET /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest获取生效配置接口
DefaultApipostClustersPOST /envs/{env}/apps/{appId}/clusters创建集群接口
DefaultApipostFieldPOST /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items新增配置接口
DefaultApipostNamespacePOST /apps/{appId}/appnamespaces创建Namespace
DefaultApipostReleasesPOST /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases发布配置接口
DefaultApiputFieldPUT /envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items/{key}修改配置接口
DefaultApirollbackPUT /envs/{env}/releases/{releaseId}/rollback回滚已发布配置接口

Documentation For Models

Documentation For Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author