/package/app/app/admin_console/lib/Kaltura/KalturaPlugins/KalturaStorageProfileClientPlugin.php

https://github.com/richhl/kalturaCE · PHP · 347 lines · 154 code · 45 blank · 148 comment · 8 complexity · 836f8b6aa36f8a06523c8c19fc38422d MD5 · raw file

  1. <?php
  2. require_once(dirname(__FILE__) . "/../KalturaClientBase.php");
  3. require_once(dirname(__FILE__) . "/../KalturaEnums.php");
  4. require_once(dirname(__FILE__) . "/../KalturaTypes.php");
  5. class KalturaStorageProfileProtocol
  6. {
  7. const KALTURA_DC = 0;
  8. const FTP = 1;
  9. const SCP = 2;
  10. const SFTP = 3;
  11. }
  12. class KalturaStorageProfileStatus
  13. {
  14. const DISABLED = 1;
  15. const AUTOMATIC = 2;
  16. const MANUAL = 3;
  17. }
  18. class KalturaStorageServePriority
  19. {
  20. const KALTURA_ONLY = 1;
  21. const KALTURA_FIRST = 2;
  22. const EXTERNAL_FIRST = 3;
  23. const EXTERNAL_ONLY = 4;
  24. }
  25. class KalturaStorageProfile extends KalturaObjectBase
  26. {
  27. /**
  28. *
  29. *
  30. * @var int
  31. * @readonly
  32. */
  33. public $id = null;
  34. /**
  35. *
  36. *
  37. * @var int
  38. * @readonly
  39. */
  40. public $createdAt = null;
  41. /**
  42. *
  43. *
  44. * @var int
  45. * @readonly
  46. */
  47. public $updatedAt = null;
  48. /**
  49. *
  50. *
  51. * @var int
  52. * @readonly
  53. */
  54. public $partnerId = null;
  55. /**
  56. *
  57. *
  58. * @var string
  59. */
  60. public $name = null;
  61. /**
  62. *
  63. *
  64. * @var string
  65. */
  66. public $desciption = null;
  67. /**
  68. *
  69. *
  70. * @var KalturaStorageProfileStatus
  71. */
  72. public $status = null;
  73. /**
  74. *
  75. *
  76. * @var KalturaStorageProfileProtocol
  77. */
  78. public $protocol = null;
  79. /**
  80. *
  81. *
  82. * @var string
  83. */
  84. public $storageUrl = null;
  85. /**
  86. *
  87. *
  88. * @var string
  89. */
  90. public $storageBaseDir = null;
  91. /**
  92. *
  93. *
  94. * @var string
  95. */
  96. public $storageUsername = null;
  97. /**
  98. *
  99. *
  100. * @var string
  101. */
  102. public $storagePassword = null;
  103. /**
  104. *
  105. *
  106. * @var bool
  107. */
  108. public $storageFtpPassiveMode = null;
  109. /**
  110. *
  111. *
  112. * @var string
  113. */
  114. public $deliveryHttpBaseUrl = null;
  115. /**
  116. *
  117. *
  118. * @var string
  119. */
  120. public $deliveryRmpBaseUrl = null;
  121. /**
  122. *
  123. *
  124. * @var string
  125. */
  126. public $deliveryIisBaseUrl = null;
  127. /**
  128. *
  129. *
  130. * @var int
  131. */
  132. public $minFileSize = null;
  133. /**
  134. *
  135. *
  136. * @var int
  137. */
  138. public $maxFileSize = null;
  139. /**
  140. *
  141. *
  142. * @var string
  143. */
  144. public $flavorParamsIds = null;
  145. /**
  146. *
  147. *
  148. * @var int
  149. */
  150. public $maxConcurrentConnections = null;
  151. /**
  152. *
  153. *
  154. * @var string
  155. */
  156. public $pathManagerClass = null;
  157. /**
  158. *
  159. *
  160. * @var string
  161. */
  162. public $urlManagerClass = null;
  163. /**
  164. * TODO - remove after events manager is implemented
  165. * No need to create enum for temp field
  166. *
  167. *
  168. * @var int
  169. */
  170. public $trigger = null;
  171. }
  172. class KalturaStorageProfileListResponse extends KalturaObjectBase
  173. {
  174. /**
  175. *
  176. *
  177. * @var array of KalturaStorageProfile
  178. * @readonly
  179. */
  180. public $objects;
  181. /**
  182. *
  183. *
  184. * @var int
  185. * @readonly
  186. */
  187. public $totalCount = null;
  188. }
  189. class KalturaStorageProfileService extends KalturaServiceBase
  190. {
  191. function __construct(KalturaClient $client = null)
  192. {
  193. parent::__construct($client);
  194. }
  195. function listByPartner(KalturaPartnerFilter $filter = null, KalturaFilterPager $pager = null)
  196. {
  197. $kparams = array();
  198. if ($filter !== null)
  199. $this->client->addParam($kparams, "filter", $filter->toParams());
  200. if ($pager !== null)
  201. $this->client->addParam($kparams, "pager", $pager->toParams());
  202. $this->client->queueServiceActionCall("storageprofile_storageprofile", "listByPartner", $kparams);
  203. if ($this->client->isMultiRequest())
  204. return null;
  205. $resultObject = $this->client->doQueue();
  206. $this->client->throwExceptionIfError($resultObject);
  207. $this->client->validateObjectType($resultObject, "KalturaStorageProfileListResponse");
  208. return $resultObject;
  209. }
  210. function updateStatus($storageId, $status)
  211. {
  212. $kparams = array();
  213. $this->client->addParam($kparams, "storageId", $storageId);
  214. $this->client->addParam($kparams, "status", $status);
  215. $this->client->queueServiceActionCall("storageprofile_storageprofile", "updateStatus", $kparams);
  216. if ($this->client->isMultiRequest())
  217. return null;
  218. $resultObject = $this->client->doQueue();
  219. $this->client->throwExceptionIfError($resultObject);
  220. $this->client->validateObjectType($resultObject, "null");
  221. return $resultObject;
  222. }
  223. function get($storageProfileId)
  224. {
  225. $kparams = array();
  226. $this->client->addParam($kparams, "storageProfileId", $storageProfileId);
  227. $this->client->queueServiceActionCall("storageprofile_storageprofile", "get", $kparams);
  228. if ($this->client->isMultiRequest())
  229. return null;
  230. $resultObject = $this->client->doQueue();
  231. $this->client->throwExceptionIfError($resultObject);
  232. $this->client->validateObjectType($resultObject, "KalturaStorageProfile");
  233. return $resultObject;
  234. }
  235. function update($storageProfileId, KalturaStorageProfile $storageProfile)
  236. {
  237. $kparams = array();
  238. $this->client->addParam($kparams, "storageProfileId", $storageProfileId);
  239. $this->client->addParam($kparams, "storageProfile", $storageProfile->toParams());
  240. $this->client->queueServiceActionCall("storageprofile_storageprofile", "update", $kparams);
  241. if ($this->client->isMultiRequest())
  242. return null;
  243. $resultObject = $this->client->doQueue();
  244. $this->client->throwExceptionIfError($resultObject);
  245. $this->client->validateObjectType($resultObject, "KalturaStorageProfile");
  246. return $resultObject;
  247. }
  248. function add(KalturaStorageProfile $storageProfile)
  249. {
  250. $kparams = array();
  251. $this->client->addParam($kparams, "storageProfile", $storageProfile->toParams());
  252. $this->client->queueServiceActionCall("storageprofile_storageprofile", "add", $kparams);
  253. if ($this->client->isMultiRequest())
  254. return null;
  255. $resultObject = $this->client->doQueue();
  256. $this->client->throwExceptionIfError($resultObject);
  257. $this->client->validateObjectType($resultObject, "KalturaStorageProfile");
  258. return $resultObject;
  259. }
  260. }
  261. class KalturaStorageProfileClientPlugin extends KalturaClientPlugin
  262. {
  263. /**
  264. * @var KalturaStorageProfileClientPlugin
  265. */
  266. protected static $instance;
  267. /**
  268. * @var KalturaStorageProfileService
  269. */
  270. public $storageProfile = null;
  271. protected function __construct(KalturaClient $client)
  272. {
  273. parent::__construct($client);
  274. $this->storageProfile = new KalturaStorageProfileService($client);
  275. }
  276. /**
  277. * @return KalturaStorageProfileClientPlugin
  278. */
  279. public static function get(KalturaClient $client)
  280. {
  281. if(!self::$instance)
  282. self::$instance = new KalturaStorageProfileClientPlugin($client);
  283. return self::$instance;
  284. }
  285. /**
  286. * @return array<KalturaServiceBase>
  287. */
  288. public function getServices()
  289. {
  290. $services = array(
  291. 'storageProfile' => $this->storageProfile,
  292. );
  293. return $services;
  294. }
  295. /**
  296. * @return string
  297. */
  298. public function getName()
  299. {
  300. return 'storageProfile';
  301. }
  302. }