<?php
namespace Qcloud\Cos;
// http://guzzle3.readthedocs.io/webservice-client/guzzle-service-descriptions.html
class Service {
public static function getService() {
return array(
'name' => 'Cos Service',
'apiVersion' => 'V5',
'description' => 'Cos V5 API Service',
'operations' => array(
// 舍弃一个分块上传且删除已上传的分片块的方法.
'AbortMultipartUpload' => array(
'httpMethod' => 'DELETE',
'uri' => '/{Bucket}{/Key*}',
'class' => 'Qcloud\\Cos\\Command',
'responseClass' => 'AbortMultipartUploadOutput',
'responseType' => 'model',
'parameters' => array(
'Bucket' => array(
'required' => true,
'type' => 'string',
'location' => 'uri'),
'Key' => array(
'required' => true,
'type' => 'string',
'location' => 'uri',
'minLength' => 1,
'filters' => array(
'Qcloud\\Cos\\Client::explodeKey')),
'UploadId' => array(
'required' => true,
'type' => 'string',
'location' => 'query',
'sentAs' => 'uploadId'
)
)
),
// 创建存储桶(Bucket)的方法.
'CreateBucket' => array(
'httpMethod' => 'PUT',
'uri' => '/{Bucket}',
'class' => 'Qcloud\\Cos\\Command',
'responseClass' => 'CreateBucketOutput',
'responseType' => 'model',
'data' => array(
'xmlRoot' => array(
'name' => 'CreateBucketConfiguration')),
'parameters' => array(
'ACL' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'x-cos-acl'),
'Bucket' => array(
'required' => true,
'type' => 'string',
'location' => 'uri'
)
)
),
// 完成整个分块上传的方法.
'CompleteMultipartUpload' => array(
'httpMethod' => 'POST',
'uri' => '/{Bucket}{/Key*}',
'class' => 'Qcloud\\Cos\\Command',
'responseClass' => 'CompleteMultipartUploadOutput',
'responseType' => 'model',
'data' => array(
'xmlRoot' => array(
'name' => 'CompleteMultipartUpload'
)
),
'parameters' => array(
'Bucket' => array(
'required' => true,
'type' => 'string',
'location' => 'uri'),
'Key' => array(
'required' => true,
'type' => 'string',
'location' => 'uri',
'minLength' => 1,
'filters' => array(
'Qcloud\\Cos\\Client::explodeKey'
)
),
'Parts' => array(
'type' => 'array',
'location' => 'xml',
'data' => array(
'xmlFlattened' => true),
'items' => array(
'name' => 'CompletedPart',
'type' => 'object',
'sentAs' => 'Part',
'properties' => array(
'ETag' => array(
'type' => 'string'
),
'PartNumber' => array(
'type' => 'numeric'
)
)
)
),
'UploadId' => array(
'required' => true,
'type' => 'string',
'location' => 'query',
'sentAs' => 'uploadId',
)
)
),
// 初始化分块上传的方法.
'CreateMultipartUpload' => array(
'httpMethod' => 'POST',
'uri' => '/{Bucket}{/Key*}?uploads',
'class' => 'Qcloud\\Cos\\Command',
'responseClass' => 'CreateMultipartUploadOutput',
'responseType' => 'model',
'data' => array(
'xmlRoot' => array(
'name' => 'CreateMultipartUploadRequest'
)
),
'parameters' => array(
'ACL' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'x-cos-acl',
),
'Bucket' => array(
'required' => true,
'type' => 'string',
'location' => 'uri',
),
'CacheControl' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'Cache-Control',
),
'ContentDisposition' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'Content-Disposition',
),
'ContentEncoding' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'Content-Encoding',
),
'ContentLanguage' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'Content-Language',
),
'ContentType' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'Content-Type',
),
'Expires' => array(
'type' => array(
'object',
'string',
'integer',
),
'format' => 'date-time-http',
'location' => 'header',
),
'GrantFullControl' => array(
'type' => 'string',
'location' => 'header',
'sentAs' => 'x-cos-grant-full-control',
),
'GrantRead' => array(
'type' => 'string