Credential.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /*
  3. * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing,
  12. * software distributed under the License is distributed on an
  13. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. * KIND, either express or implied. See the License for the
  15. * specific language governing permissions and limitations
  16. * under the License.
  17. */
  18. namespace TencentCloud\Common;
  19. /**
  20. * 证书类,保存认证相关参数
  21. * @package TencentCloud\Common
  22. */
  23. class Credential
  24. {
  25. /**
  26. * @var string secretId
  27. */
  28. private $secretId;
  29. /**
  30. * @var string secretKey
  31. */
  32. private $secretKey;
  33. /**
  34. * @var string token
  35. */
  36. private $token;
  37. /**
  38. * Credential constructor.
  39. * @param string $secretId secretId
  40. * @param string $secretKey secretKey
  41. * @param string $token token
  42. */
  43. public function __construct($secretId, $secretKey, $token = null)
  44. {
  45. $this->secretId = $secretId;
  46. $this->secretKey = $secretKey;
  47. $this->token = $token;
  48. }
  49. /**
  50. * 设置secretId
  51. * @param string $secretId secretId
  52. */
  53. public function setSecretId($secretId)
  54. {
  55. $this->secretId = $secretId;
  56. }
  57. /**
  58. * 设置secretKey
  59. * @param string $secretKey secretKey
  60. */
  61. public function setSecretKey($secretKey)
  62. {
  63. $this->secretKey = $secretKey;
  64. }
  65. /**
  66. * @param string $token 要设置的token
  67. */
  68. public function setToken($token)
  69. {
  70. $this->token = $token;
  71. }
  72. /**
  73. * 获取secretId
  74. * @return string secretId
  75. */
  76. public function getSecretId()
  77. {
  78. return $this->secretId;
  79. }
  80. /**
  81. * 获取secretKey
  82. * @return string secretKey
  83. */
  84. public function getSecretKey()
  85. {
  86. return $this->secretKey;
  87. }
  88. /**
  89. * 获取token
  90. * @return null|string token
  91. */
  92. public function getToken()
  93. {
  94. return $this->token;
  95. }
  96. }