Constants.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. /**
  3. * Copyright 2019 Huawei Technologies Co.,Ltd.
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  5. * this file except in compliance with the License. You may obtain a copy of the
  6. * License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software distributed
  11. * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  12. * CONDITIONS OF ANY KIND, either express or implied. See the License for the
  13. * specific language governing permissions and limitations under the License.
  14. *
  15. */
  16. namespace Obs\Internal\Resource;
  17. class Constants
  18. {
  19. const ALLOWED_RESOURCE_PARAMTER_NAMES = [
  20. 'acl',
  21. 'policy',
  22. 'torrent',
  23. 'logging',
  24. 'location',
  25. 'storageinfo',
  26. 'quota',
  27. 'storagepolicy',
  28. 'requestpayment',
  29. 'versions',
  30. 'versioning',
  31. 'versionid',
  32. 'uploads',
  33. 'uploadid',
  34. 'partnumber',
  35. 'website',
  36. 'notification',
  37. 'lifecycle',
  38. 'deletebucket',
  39. 'delete',
  40. 'cors',
  41. 'restore',
  42. 'tagging',
  43. 'response-content-type',
  44. 'response-content-language',
  45. 'response-expires',
  46. 'response-cache-control',
  47. 'response-content-disposition',
  48. 'response-content-encoding',
  49. 'x-image-process',
  50. 'backtosource',
  51. 'storageclass',
  52. 'replication',
  53. 'append',
  54. 'position',
  55. 'x-oss-process',
  56. 'CDNNotifyConfiguration',
  57. 'attname',
  58. 'customdomain',
  59. 'directcoldaccess',
  60. 'encryption',
  61. 'inventory',
  62. 'length',
  63. 'metadata',
  64. 'modify',
  65. 'name',
  66. 'rename',
  67. 'truncate',
  68. 'x-image-save-bucket',
  69. 'x-image-save-object',
  70. 'x-obs-security-token',
  71. 'x-obs-callback',
  72. ];
  73. const ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES = [
  74. 'content-type',
  75. 'content-md5',
  76. 'content-length',
  77. 'content-language',
  78. 'expires',
  79. 'origin',
  80. 'cache-control',
  81. 'content-disposition',
  82. 'content-encoding',
  83. 'access-control-request-method',
  84. 'access-control-request-headers',
  85. 'x-default-storage-class',
  86. 'location',
  87. 'date',
  88. 'etag',
  89. 'range',
  90. 'host',
  91. 'if-modified-since',
  92. 'if-unmodified-since',
  93. 'if-match',
  94. 'if-none-match',
  95. 'last-modified',
  96. 'content-range',
  97. 'success-action-redirect',
  98. ];
  99. const ALLOWED_RESPONSE_HTTP_HEADER_METADATA_NAMES = [
  100. 'content-type',
  101. 'content-md5',
  102. 'content-length',
  103. 'content-language',
  104. 'expires',
  105. 'origin',
  106. 'cache-control',
  107. 'content-disposition',
  108. 'content-encoding',
  109. 'x-default-storage-class',
  110. 'location',
  111. 'date',
  112. 'etag',
  113. 'host',
  114. 'last-modified',
  115. 'content-range',
  116. 'x-reserved',
  117. 'access-control-allow-origin',
  118. 'access-control-allow-headers',
  119. 'access-control-max-age',
  120. 'access-control-allow-methods',
  121. 'access-control-expose-headers',
  122. 'connection',
  123. ];
  124. public static function selectConstants($signature)
  125. {
  126. $signature = (strcasecmp($signature, 'obs') === 0) ? 'OBS' : 'V2';
  127. return __NAMESPACE__ . '\\' . $signature . 'Constants';
  128. }
  129. public static function selectRequestResource($signature)
  130. {
  131. $signature = (strcasecmp($signature, 'obs') === 0) ? 'OBS' : 'V2';
  132. return (__NAMESPACE__ . '\\' . $signature . 'RequestResource');
  133. }
  134. }