Skip to content

Commit 20e149f

Browse files
authored
Fix service (#9)
1 parent bf63d14 commit 20e149f

File tree

2 files changed

+285
-3
lines changed

2 files changed

+285
-3
lines changed

src/Qcloud/Cos/GetServiceListener.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ public static function getSubscribedEvents()
3434
* @param Event $event Event emitted
3535
*/
3636
public function onRequestBeforeSend(Event $event) {
37-
if($event['request']->getPath() == '/' && $event['request']->getMethod() == 'GET')
38-
{$event['request']->setUrl('http://service.cos.myqcloud.com');}
37+
#print_r($event['request']);
38+
if($event['request']->getPath() == '/ASDWQdsawqefdQWESDFFSDFSADCXSVSDQWERTREGERTYTHDF' && $event['request']->getMethod() == 'GET')
39+
{
40+
$event['request']->setPath('/');
41+
$event['request']->setUrl('http://service.cos.myqcloud.com');
42+
}
3943
/*
4044
if(!$this->credentials instanceof NullCredentials) {
4145
$this->signature->signRequest($event['request'], $this->credentials);

src/Qcloud/Cos/Service.php

Lines changed: 279 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static function getService() {
1313
'operations' => array(
1414
'ListBuckets' => array(
1515
'httpMethod' => 'GET',
16-
'uri' => '/',
16+
'uri' => '/ASDWQdsawqefdQWESDFFSDFSADCXSVSDQWERTREGERTYTHDF',
1717
'class' => 'Qcloud\\Cos\\Command',
1818
'responseClass' => 'ListBucketsOutput',
1919
'responseType' => 'model',
@@ -370,6 +370,167 @@ public static function getService() {
370370
'sentAs' => 'x-cos-meta-',
371371
'additionalProperties' => array(
372372
'type' => 'string')))),
373+
'PutObjectAcl' => array(
374+
'httpMethod' => 'PUT',
375+
'uri' => '/{Bucket}{/Key*}?acl',
376+
'class' => 'Qcloud\\Cos\\Command',
377+
'responseClass' => 'PutObjectAclOutput',
378+
'responseType' => 'model',
379+
'data' => array(
380+
'xmlRoot' => array(
381+
'name' => 'AccessControlPolicy',
382+
),
383+
),
384+
'parameters' => array(
385+
'ACL' => array(
386+
'type' => 'string',
387+
'location' => 'header',
388+
'sentAs' => 'x-cos-acl',
389+
),
390+
'Grants' => array(
391+
'type' => 'array',
392+
'location' => 'xml',
393+
'sentAs' => 'AccessControlList',
394+
'items' => array(
395+
'name' => 'Grant',
396+
'type' => 'object',
397+
'properties' => array(
398+
'Grantee' => array(
399+
'type' => 'object',
400+
'properties' => array(
401+
'DisplayName' => array(
402+
'type' => 'string'),
403+
/*
404+
'EmailAddress' => array(
405+
'type' => 'string'),
406+
*/
407+
'ID' => array(
408+
'type' => 'string'),
409+
/*
410+
'Type' => array(
411+
'type' => 'string',
412+
'sentAs' => 'xsi:type',
413+
'data' => array(
414+
'xmlAttribute' => true,
415+
'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')),
416+
*/
417+
/*'URI' => array(
418+
'type' => 'string') */)),
419+
'Permission' => array(
420+
'type' => 'string',
421+
),
422+
),
423+
),
424+
),
425+
'Owner' => array(
426+
'type' => 'object',
427+
'location' => 'xml',
428+
'properties' => array(
429+
'DisplayName' => array(
430+
'type' => 'string',
431+
),
432+
'ID' => array(
433+
'type' => 'string',
434+
),
435+
),
436+
),
437+
'Bucket' => array(
438+
'required' => true,
439+
'type' => 'string',
440+
'location' => 'uri',
441+
),
442+
'GrantFullControl' => array(
443+
'type' => 'string',
444+
'location' => 'header',
445+
'sentAs' => 'x-cos-grant-full-control',
446+
),
447+
'GrantRead' => array(
448+
'type' => 'string',
449+
'location' => 'header',
450+
'sentAs' => 'x-cos-grant-read',
451+
),
452+
'GrantReadACP' => array(
453+
'type' => 'string',
454+
'location' => 'header',
455+
'sentAs' => 'x-cos-grant-read-acp',
456+
),
457+
'GrantWrite' => array(
458+
'type' => 'string',
459+
'location' => 'header',
460+
'sentAs' => 'x-cos-grant-write',
461+
),
462+
'GrantWriteACP' => array(
463+
'type' => 'string',
464+
'location' => 'header',
465+
'sentAs' => 'x-cos-grant-write-acp',
466+
),
467+
'Key' => array(
468+
'required' => true,
469+
'type' => 'string',
470+
'location' => 'uri',
471+
'minLength' => 1,
472+
#!!!!!!!!!!!!!
473+
// 'filters' => array(
474+
// 'Aws\\S3\\S3Client::explodeKey',
475+
// ),
476+
),
477+
'RequestPayer' => array(
478+
'type' => 'string',
479+
'location' => 'header',
480+
'sentAs' => 'x-cos-request-payer',
481+
),
482+
'ACP' => array(
483+
'type' => 'object',
484+
'additionalProperties' => true,
485+
),
486+
),
487+
'errorResponses' => array(
488+
array(
489+
'reason' => 'The specified key does not exist.',
490+
'class' => 'NoSuchKeyException',
491+
),
492+
),
493+
),
494+
'GetObjectAcl' => array(
495+
'httpMethod' => 'GET',
496+
'uri' => '/{Bucket}{/Key*}?acl',
497+
'class' => 'Qcloud\\Cos\\Command',
498+
'responseClass' => 'GetObjectAclOutput',
499+
'responseType' => 'model',
500+
'parameters' => array(
501+
'Bucket' => array(
502+
'required' => true,
503+
'type' => 'string',
504+
'location' => 'uri',
505+
),
506+
'Key' => array(
507+
'required' => true,
508+
'type' => 'string',
509+
'location' => 'uri',
510+
'minLength' => 1,
511+
),
512+
'VersionId' => array(
513+
'type' => 'string',
514+
'location' => 'query',
515+
'sentAs' => 'versionId',
516+
),
517+
'RequestPayer' => array(
518+
'type' => 'string',
519+
'location' => 'header',
520+
'sentAs' => 'x-amz-request-payer',
521+
),
522+
'command.expects' => array(
523+
'static' => true,
524+
'default' => 'application/xml',
525+
),
526+
),
527+
'errorResponses' => array(
528+
array(
529+
'reason' => 'The specified key does not exist.',
530+
'class' => 'NoSuchKeyException',
531+
),
532+
),
533+
),
373534
'CreateMultipartUpload' => array(
374535
'httpMethod' => 'POST',
375536
'uri' => '/{Bucket}{/Key*}?uploads',
@@ -742,6 +903,69 @@ public static function getService() {
742903
'RequestId' => array(
743904
'location' => 'header',
744905
'sentAs' => 'x-cos-request-id'))),
906+
'GetObjectAclOutput' => array(
907+
'type' => 'object',
908+
'additionalProperties' => true,
909+
'properties' => array(
910+
'Owner' => array(
911+
'type' => 'object',
912+
'location' => 'xml',
913+
'properties' => array(
914+
'DisplayName' => array(
915+
'type' => 'string',
916+
),
917+
'ID' => array(
918+
'type' => 'string',
919+
),
920+
),
921+
),
922+
'Grants' => array(
923+
'type' => 'array',
924+
'location' => 'xml',
925+
'sentAs' => 'AccessControlList',
926+
'items' => array(
927+
'name' => 'Grant',
928+
'type' => 'object',
929+
'sentAs' => 'Grant',
930+
'properties' => array(
931+
'Grantee' => array(
932+
'type' => 'object',
933+
'properties' => array(
934+
'DisplayName' => array(
935+
'type' => 'string'),
936+
/*
937+
'EmailAddress' => array(
938+
'type' => 'string'),
939+
*/
940+
'ID' => array(
941+
'type' => 'string'),
942+
/*
943+
'Type' => array(
944+
'type' => 'string',
945+
'sentAs' => 'xsi:type',
946+
'data' => array(
947+
'xmlAttribute' => true,
948+
'xmlNamespace' => 'http://www.w3.org/2001/XMLSchema-instance')),
949+
*/
950+
/*'URI' => array(
951+
'type' => 'string') */)),
952+
'Permission' => array(
953+
'type' => 'string',
954+
),
955+
),
956+
),
957+
),
958+
'RequestCharged' => array(
959+
'type' => 'string',
960+
'location' => 'header',
961+
'sentAs' => 'x-cos-request-charged',
962+
),
963+
'RequestId' => array(
964+
'location' => 'header',
965+
'sentAs' => 'x-cos-request-id',
966+
),
967+
),
968+
),
745969
'UploadPartOutput' => array(
746970
'type' => 'object',
747971
'additionalProperties' => true,
@@ -771,6 +995,21 @@ public static function getService() {
771995
'sentAs' => 'x-cos-request-id'),
772996
'ObjectURL' => array(
773997
))),
998+
'PutObjectAclOutput' => array(
999+
'type' => 'object',
1000+
'additionalProperties' => true,
1001+
'properties' => array(
1002+
'RequestCharged' => array(
1003+
'type' => 'string',
1004+
'location' => 'header',
1005+
'sentAs' => 'x-cos-request-charged',
1006+
),
1007+
'RequestId' => array(
1008+
'location' => 'header',
1009+
'sentAs' => 'x-cos-request-id',
1010+
),
1011+
),
1012+
),
7741013
'ListPartsOutput' => array(
7751014
'type' => 'object',
7761015
'additionalProperties' => true,
@@ -905,6 +1144,45 @@ public static function getService() {
9051144
'RequestId' => array(
9061145
'location' => 'header',
9071146
'sentAs' => 'x-cos-request-id'))),
1147+
'ListBucketsOutput' => array(
1148+
'type' => 'object',
1149+
'additionalProperties' => true,
1150+
'properties' => array(
1151+
'Buckets' => array(
1152+
'type' => 'array',
1153+
'location' => 'xml',
1154+
'items' => array(
1155+
'name' => 'Bucket',
1156+
'type' => 'object',
1157+
'sentAs' => 'Bucket',
1158+
'properties' => array(
1159+
'Name' => array(
1160+
'type' => 'string',
1161+
),
1162+
'CreationDate' => array(
1163+
'type' => 'string',
1164+
),
1165+
),
1166+
),
1167+
),
1168+
'Owner' => array(
1169+
'type' => 'object',
1170+
'location' => 'xml',
1171+
'properties' => array(
1172+
'DisplayName' => array(
1173+
'type' => 'string',
1174+
),
1175+
'ID' => array(
1176+
'type' => 'string',
1177+
),
1178+
),
1179+
),
1180+
'RequestId' => array(
1181+
'location' => 'header',
1182+
'sentAs' => 'x-cos-request-id',
1183+
),
1184+
),
1185+
),
9081186
'HeadObjectOutput' => array(
9091187
'type' => 'object',
9101188
'additionalProperties' => true,

0 commit comments

Comments
 (0)