kscsdk/ksyun_sdk

ksyun openapi sdk

0.30 2019-05-15 07:19 UTC

README

##使用方式 ####composer引用

composer require kscsdk/ksyun_sdk

####ak|sk配置

获取到用户的aksk后配置在文件

~\.ksyun\config

####config文件结构

{
    "ak":"your ak",
    "sk":"your sk"
}

##功能列表

敬请期待

##推荐demo

<?php
require('./vendor/autoload.php');
use Ksyun\Service\Iam;
$response = Iam::getInstance()->request('ListUsers');
echo (string)$response->getBody();
<?php
require('./vendor/autoload.php');
use Ksyun\Service\Kec;
$response = Kec::getInstance()->request('DescribeInstances', [], 'cn-beijing-6');
echo (string)$response->getBody();
<?php
require('./vendor/autoload.php');
use Ksyun\Service\Eip;
$response = Eip::getInstance()->request('DescribeAddresses', ['query' => ['MaxResults' => 10]], 'cn-beijing-6');
echo (string)$response->getBody();
<?php
require('./vendor/autoload.php');
use Ksyun\Service\Iam;
$ak = 'this is ak';
$sk = 'this is sk';
$response = Iam::getInstance()->request('ListUsers', ['v4_credentials' => ['ak' => $ak, 'sk' => $sk]]);
echo (string)$response->getBody();
<?php
require('./vendor/autoload.php');
use Ksyun\Service\Cdn;   //详细CDN api调用示例 位于./tests/CdnTest.php
$response = Iam::getInstance()->request('GetCdnDomains', ['query'=>['DomainStatus' => 'online', 'CdnType' => 'download']);
echo (string)$response->getBody();
<?php
require('./vendor/autoload.php');
use Ksyun\Service\Monitor;   //详细Monitor api调用示例 位于./tests/MonitorTest.php
$response = Monitor::getInstance()->request('ListMetrics', ['query'=['Namespace' => 'KEC', 'InstanceID' => '7af8d721-fb03-4d5b-a4a7-0ff983a2c30b', 'PageIndex' => 1]], 'cn-beijing-6'); 
echo (string)$response->getBody();