Constants.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. const ALLOWED_RESOURCE_PARAMTER_NAMES = [
  19. 'acl',
  20. 'policy',
  21. 'torrent',
  22. 'logging',
  23. 'location',
  24. 'storageinfo',
  25. 'quota',
  26. 'storagepolicy',
  27. 'requestpayment',
  28. 'versions',
  29. 'versioning',
  30. 'versionid',
  31. 'uploads',
  32. 'uploadid',
  33. 'partnumber',
  34. 'website',
  35. 'notification',
  36. 'lifecycle',
  37. 'deletebucket',
  38. 'delete',
  39. 'cors',
  40. 'restore',
  41. 'tagging',
  42. 'response-content-type',
  43. 'response-content-language',
  44. 'response-expires',
  45. 'response-cache-control',
  46. 'response-content-disposition',
  47. 'response-content-encoding',
  48. 'x-image-process',
  49. 'backtosource',
  50. 'storageclass',
  51. 'replication',
  52. 'append',
  53. 'position',
  54. 'x-oss-process',
  55. 'CDNNotifyConfiguration',
  56. 'attname',
  57. 'customdomain',
  58. 'directcoldaccess',
  59. 'encryption',
  60. 'inventory',
  61. 'length',
  62. 'metadata',
  63. 'modify',
  64. 'name',
  65. 'rename',
  66. 'truncate',
  67. 'x-image-save-bucket',
  68. 'x-image-save-object',
  69. 'x-obs-security-token',
  70. 'x-obs-callback',
  71. ];
  72. const ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES = [
  73. 'content-type',
  74. 'content-md5',
  75. 'content-length',
  76. 'content-language',
  77. 'expires',
  78. 'origin',
  79. 'cache-control',
  80. 'content-disposition',
  81. 'content-encoding',
  82. 'access-control-request-method',
  83. 'access-control-request-headers',
  84. 'x-default-storage-class',
  85. 'location',
  86. 'date',
  87. 'etag',
  88. 'range',
  89. 'host',
  90. 'if-modified-since',
  91. 'if-unmodified-since',
  92. 'if-match',
  93. 'if-none-match',
  94. 'last-modified',
  95. 'content-range',
  96. 'success-action-redirect'
  97. ];
  98. const ALLOWED_RESPONSE_HTTP_HEADER_METADATA_NAMES = [
  99. 'content-type',
  100. 'content-md5',
  101. 'content-length',
  102. 'content-language',
  103. 'expires',
  104. 'origin',
  105. 'cache-control',
  106. 'content-disposition',
  107. 'content-encoding',
  108. 'x-default-storage-class',
  109. 'location',
  110. 'date',
  111. 'etag',
  112. 'host',
  113. 'last-modified',
  114. 'content-range',
  115. 'x-reserved',
  116. 'access-control-allow-origin',
  117. 'access-control-allow-headers',
  118. 'access-control-max-age',
  119. 'access-control-allow-methods',
  120. 'access-control-expose-headers',
  121. 'connection'
  122. ];
  123. public static function selectConstants($signature) {
  124. $signature = (strcasecmp ( $signature, 'obs' ) === 0) ? 'OBS' : 'V2';
  125. return __NAMESPACE__ . '\\' . $signature . 'Constants';
  126. }
  127. public static function selectRequestResource($signature) {
  128. $signature = (strcasecmp ( $signature, 'obs' ) === 0) ? 'OBS' : 'V2';
  129. return (__NAMESPACE__ . '\\' . $signature . 'RequestResource');
  130. }
  131. }