Constants.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. ];
  56. const ALLOWED_REQUEST_HTTP_HEADER_METADATA_NAMES = [
  57. 'content-type',
  58. 'content-md5',
  59. 'content-length',
  60. 'content-language',
  61. 'expires',
  62. 'origin',
  63. 'cache-control',
  64. 'content-disposition',
  65. 'content-encoding',
  66. 'access-control-request-method',
  67. 'access-control-request-headers',
  68. 'x-default-storage-class',
  69. 'location',
  70. 'date',
  71. 'etag',
  72. 'range',
  73. 'host',
  74. 'if-modified-since',
  75. 'if-unmodified-since',
  76. 'if-match',
  77. 'if-none-match',
  78. 'last-modified',
  79. 'content-range',
  80. 'success-action-redirect'
  81. ];
  82. const ALLOWED_RESPONSE_HTTP_HEADER_METADATA_NAMES = [
  83. 'content-type',
  84. 'content-md5',
  85. 'content-length',
  86. 'content-language',
  87. 'expires',
  88. 'origin',
  89. 'cache-control',
  90. 'content-disposition',
  91. 'content-encoding',
  92. 'x-default-storage-class',
  93. 'location',
  94. 'date',
  95. 'etag',
  96. 'host',
  97. 'last-modified',
  98. 'content-range',
  99. 'x-reserved',
  100. 'access-control-allow-origin',
  101. 'access-control-allow-headers',
  102. 'access-control-max-age',
  103. 'access-control-allow-methods',
  104. 'access-control-expose-headers',
  105. 'connection'
  106. ];
  107. public static function selectConstants($signature) {
  108. $signature = (strcasecmp ( $signature, 'obs' ) === 0) ? 'OBS' : 'V2';
  109. return __NAMESPACE__ . '\\' . $signature . 'Constants';
  110. }
  111. public static function selectRequestResource($signature) {
  112. $signature = (strcasecmp ( $signature, 'obs' ) === 0) ? 'OBS' : 'V2';
  113. return (__NAMESPACE__ . '\\' . $signature . 'RequestResource');
  114. }
  115. }