PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/src/MediaServices/Models/Task.php

http://github.com/WindowsAzure/azure-sdk-for-php
PHP | 655 lines | 268 code | 78 blank | 309 comment | 21 complexity | ed65afb6c01e096a1ae9803baecdad8f MD5 | raw file
  1. <?php
  2. /**
  3. * LICENSE: Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. * http://www.apache.org/licenses/LICENSE-2.0.
  7. *
  8. * Unless required by applicable law or agreed to in writing, software
  9. * distributed under the License is distributed on an "AS IS" BASIS,
  10. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. * See the License for the specific language governing permissions and
  12. * limitations under the License.
  13. *
  14. * PHP version 5
  15. *
  16. * @category Microsoft
  17. *
  18. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  19. * @copyright Microsoft Corporation
  20. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  21. *
  22. * @link https://github.com/windowsazure/azure-sdk-for-php
  23. */
  24. namespace WindowsAzure\MediaServices\Models;
  25. use WindowsAzure\Common\Internal\Validate;
  26. /**
  27. * Represents task object used in media services.
  28. *
  29. * @category Microsoft
  30. *
  31. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  32. * @copyright Microsoft Corporation
  33. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  34. *
  35. * @version Release: 0.5.0_2016-11
  36. *
  37. * @link https://github.com/windowsazure/azure-sdk-for-php
  38. */
  39. class Task
  40. {
  41. /**
  42. * The state of the task "none".
  43. *
  44. * @var int
  45. */
  46. const STATE_NONE = 0;
  47. /**
  48. * The state of the task "active".
  49. *
  50. * @var int
  51. */
  52. const STATE_ACTIVE = 1;
  53. /**
  54. * The state of the task "running".
  55. *
  56. * @var int
  57. */
  58. const STATE_RUNNING = 2;
  59. /**
  60. * The state of the task "completed".
  61. *
  62. * @var int
  63. */
  64. const STATE_COMPLETED = 3;
  65. /**
  66. * Task id.
  67. *
  68. * @var string
  69. */
  70. private $_id;
  71. /**
  72. * Configuration.
  73. *
  74. * @var string
  75. */
  76. private $_configuration;
  77. /**
  78. * End tine.
  79. *
  80. * @var \DateTime
  81. */
  82. private $_endTime;
  83. /**
  84. * Media procesot id.
  85. *
  86. * @var string
  87. */
  88. private $_mediaProcessorId;
  89. /**
  90. * Performance message.
  91. *
  92. * @var string
  93. */
  94. private $_perfMessage;
  95. /**
  96. * Progress.
  97. *
  98. * @var float
  99. */
  100. private $_progress;
  101. /**
  102. * Running duration.
  103. *
  104. * @var float
  105. */
  106. private $_runningDuration;
  107. /**
  108. * Task body.
  109. *
  110. * @var string
  111. */
  112. private $_taskBody;
  113. /**
  114. * Options.
  115. *
  116. * @var int
  117. */
  118. private $_options;
  119. /**
  120. * Encryption key id.
  121. *
  122. * @var string
  123. */
  124. private $_encryptionKeyId;
  125. /**
  126. * Encryption scheme.
  127. *
  128. * @var string
  129. */
  130. private $_encryptionScheme;
  131. /**
  132. * Encryption version.
  133. *
  134. * @var string
  135. */
  136. private $_encryptionVersion;
  137. /**
  138. * Initialization vector.
  139. *
  140. * @var string
  141. */
  142. private $_initializationVector;
  143. /**
  144. * State.
  145. *
  146. * @var int
  147. */
  148. private $_state;
  149. /**
  150. * Name.
  151. *
  152. * @var string
  153. */
  154. private $_name;
  155. /**
  156. * Priority.
  157. *
  158. * @var int
  159. */
  160. private $_priority;
  161. /**
  162. * Start time.
  163. *
  164. * @var \DateTime
  165. */
  166. private $_startTime;
  167. /**
  168. * HistoricalEvents.
  169. *
  170. * @var TaskHistoricalEvent[]
  171. */
  172. private $_historicalEvents;
  173. /**
  174. * ErrorDetails.
  175. *
  176. * @var ErrorDetail[]
  177. */
  178. private $_errorDetails;
  179. /**
  180. * Create task from array.
  181. *
  182. * @param array $options Array containing values for object properties
  183. *
  184. * @return Task
  185. */
  186. public static function createFromOptions(array $options)
  187. {
  188. Validate::notNull($options['TaskBody'], 'options[TaskBody]');
  189. Validate::notNull($options['Options'], 'options[Options]');
  190. Validate::notNull($options['MediaProcessorId'], 'options[MediaProcessorId]');
  191. $task = new self(
  192. $options['TaskBody'],
  193. $options['MediaProcessorId'],
  194. $options['Options']
  195. );
  196. $task->fromArray($options);
  197. return $task;
  198. }
  199. /**
  200. * Create task.
  201. *
  202. * @param string $taskBody Task body
  203. * @param string $mediaProcessorId Media processor identifier
  204. * @param int $options Task encryption options
  205. */
  206. public function __construct($taskBody, $mediaProcessorId, $options)
  207. {
  208. $this->_taskBody = $taskBody;
  209. $this->_options = $options;
  210. $this->_mediaProcessorId = $mediaProcessorId;
  211. }
  212. /**
  213. * Fill task from array.
  214. *
  215. * @param array $options Array containing values for object properties
  216. */
  217. public function fromArray(array $options)
  218. {
  219. if (isset($options['Id'])) {
  220. Validate::isString($options['Id'], 'options[Id]');
  221. $this->_id = $options['Id'];
  222. }
  223. if (isset($options['Configuration'])) {
  224. Validate::isString($options['Configuration'], 'options[Configuration]');
  225. $this->_configuration = $options['Configuration'];
  226. }
  227. if (isset($options['EndTime'])) {
  228. Validate::isDateString($options['EndTime'], 'options[EndTime]');
  229. $this->_endTime = new \DateTime($options['EndTime']);
  230. }
  231. if (isset($options['MediaProcessorId'])) {
  232. Validate::isString(
  233. $options['MediaProcessorId'],
  234. 'options[MediaProcessorId]'
  235. );
  236. $this->_mediaProcessorId = $options['MediaProcessorId'];
  237. }
  238. if (isset($options['Name'])) {
  239. Validate::isString($options['Name'], 'options[Name]');
  240. $this->_name = $options['Name'];
  241. }
  242. if (isset($options['PerfMessage'])) {
  243. Validate::isString($options['PerfMessage'], 'options[PerfMessage]');
  244. $this->_perfMessage = $options['PerfMessage'];
  245. }
  246. if (isset($options['Priority'])) {
  247. Validate::isInteger($options['Priority'], 'options[Priority]');
  248. $this->_priority = $options['Priority'];
  249. }
  250. if (isset($options['Progress'])) {
  251. Validate::isDouble($options['Progress'], 'options[Progress]');
  252. $this->_progress = $options['Progress'];
  253. }
  254. if (isset($options['RunningDuration'])) {
  255. Validate::isDouble(
  256. $options['RunningDuration'],
  257. 'options[RunningDuration]'
  258. );
  259. $this->_runningDuration = $options['RunningDuration'];
  260. }
  261. if (isset($options['StartTime'])) {
  262. Validate::isDateString($options['StartTime'], 'options[StartTime]');
  263. $this->_startTime = new \DateTime($options['StartTime']);
  264. }
  265. if (isset($options['State'])) {
  266. Validate::isInteger($options['State'], 'options[State]');
  267. $this->_state = $options['State'];
  268. }
  269. if (isset($options['TaskBody'])) {
  270. Validate::isString($options['TaskBody'], 'options[TaskBody]');
  271. $this->_taskBody = $options['TaskBody'];
  272. }
  273. if (isset($options['Options'])) {
  274. Validate::isInteger($options['Options'], 'options[Options]');
  275. $this->_options = $options['Options'];
  276. }
  277. if (isset($options['EncryptionKeyId'])) {
  278. Validate::isString(
  279. $options['EncryptionKeyId'],
  280. 'options[EncryptionKeyId]'
  281. );
  282. $this->_encryptionKeyId = $options['EncryptionKeyId'];
  283. }
  284. if (isset($options['EncryptionScheme'])) {
  285. Validate::isString(
  286. $options['EncryptionScheme'],
  287. 'options[EncryptionScheme]'
  288. );
  289. $this->_encryptionScheme = $options['EncryptionScheme'];
  290. }
  291. if (isset($options['EncryptionVersion'])) {
  292. Validate::isString(
  293. $options['EncryptionVersion'],
  294. 'options[EncryptionVersion]'
  295. );
  296. $this->_encryptionVersion = $options['EncryptionVersion'];
  297. }
  298. if (isset($options['InitializationVector'])) {
  299. Validate::isString(
  300. $options['InitializationVector'],
  301. 'options[InitializationVector]'
  302. );
  303. $this->_initializationVector = $options['InitializationVector'];
  304. }
  305. if (isset($options['ErrorDetails'])) {
  306. $this->_errorDetails = [];
  307. if (is_array($options['ErrorDetails'])) {
  308. foreach ($options['ErrorDetails'] as $errorDetail) {
  309. $this->_errorDetails[] = ErrorDetail::createFromOptions(
  310. $errorDetail
  311. );
  312. }
  313. }
  314. }
  315. if (isset($options['HistoricalEvents'])) {
  316. $this->_historicalEvents = [];
  317. if (is_array($options['HistoricalEvents'])) {
  318. foreach ($options['HistoricalEvents'] as $historicalEvent) {
  319. $evnt = TaskHistoricalEvent::createFromOptions($historicalEvent);
  320. $this->_historicalEvents[] = $evnt;
  321. }
  322. }
  323. }
  324. }
  325. /**
  326. * Get "Name".
  327. *
  328. * @return string
  329. */
  330. public function getName()
  331. {
  332. return $this->_name;
  333. }
  334. /**
  335. * Set "Name".
  336. *
  337. * @param string $value Name
  338. */
  339. public function setName($value)
  340. {
  341. $this->_name = $value;
  342. }
  343. /**
  344. * Get "State".
  345. *
  346. * @return int
  347. */
  348. public function getState()
  349. {
  350. return $this->_state;
  351. }
  352. /**
  353. * Get "Task id".
  354. *
  355. * @return string
  356. */
  357. public function getId()
  358. {
  359. return $this->_id;
  360. }
  361. /**
  362. * Get "Start time".
  363. *
  364. * @return \DateTime
  365. */
  366. public function getStartTime()
  367. {
  368. return $this->_startTime;
  369. }
  370. /**
  371. * Get "Running duration".
  372. *
  373. * @return float
  374. */
  375. public function getRunningDuration()
  376. {
  377. return $this->_runningDuration;
  378. }
  379. /**
  380. * Get "Priority".
  381. *
  382. * @return int
  383. */
  384. public function getPriority()
  385. {
  386. return $this->_priority;
  387. }
  388. /**
  389. * Set "Priority".
  390. *
  391. * @param int $value Priority
  392. */
  393. public function setPriority($value)
  394. {
  395. $this->_priority = $value;
  396. }
  397. /**
  398. * Get "End time".
  399. *
  400. * @return \DateTime
  401. */
  402. public function getEndTime()
  403. {
  404. return $this->_endTime;
  405. }
  406. /**
  407. * Get "Initialization vector".
  408. *
  409. * @return string
  410. */
  411. public function getInitializationVector()
  412. {
  413. return $this->_initializationVector;
  414. }
  415. /**
  416. * Set "Initialization vector".
  417. *
  418. * @param string $value Initialization vector
  419. */
  420. public function setInitializationVector($value)
  421. {
  422. $this->_initializationVector = $value;
  423. }
  424. /**
  425. * Get "Encryption version".
  426. *
  427. * @return string
  428. */
  429. public function getEncryptionVersion()
  430. {
  431. return $this->_encryptionVersion;
  432. }
  433. /**
  434. * Set "Encryption version".
  435. *
  436. * @param string $value Encryption version
  437. */
  438. public function setEncryptionVersion($value)
  439. {
  440. $this->_encryptionVersion = $value;
  441. }
  442. /**
  443. * Get "Encryption scheme".
  444. *
  445. * @return string
  446. */
  447. public function getEncryptionScheme()
  448. {
  449. return $this->_encryptionScheme;
  450. }
  451. /**
  452. * Set "Encryption scheme".
  453. *
  454. * @param string $value Encryption scheme
  455. */
  456. public function setEncryptionScheme($value)
  457. {
  458. $this->_encryptionScheme = $value;
  459. }
  460. /**
  461. * Get "Encryption key id".
  462. *
  463. * @return string
  464. */
  465. public function getEncryptionKeyId()
  466. {
  467. return $this->_encryptionKeyId;
  468. }
  469. /**
  470. * Set "Encryption key id".
  471. *
  472. * @param string $value Encryption key id
  473. */
  474. public function setEncryptionKeyId($value)
  475. {
  476. $this->_encryptionKeyId = $value;
  477. }
  478. /**
  479. * Get "Options".
  480. *
  481. * @return int
  482. */
  483. public function getOptions()
  484. {
  485. return $this->_options;
  486. }
  487. /**
  488. * Get "Task body".
  489. *
  490. * @return string
  491. */
  492. public function getTaskBody()
  493. {
  494. return $this->_taskBody;
  495. }
  496. /**
  497. * Set "Task body".
  498. *
  499. * @param string $value Task body
  500. */
  501. public function setTaskBody($value)
  502. {
  503. $this->_taskBody = $value;
  504. }
  505. /**
  506. * Get "Progress".
  507. *
  508. * @return float
  509. */
  510. public function getProgress()
  511. {
  512. return $this->_progress;
  513. }
  514. /**
  515. * Get "Performance message".
  516. *
  517. * @return string
  518. */
  519. public function getPerfMessage()
  520. {
  521. return $this->_perfMessage;
  522. }
  523. /**
  524. * Get "Media procesot id".
  525. *
  526. * @return string
  527. */
  528. public function getMediaProcessorId()
  529. {
  530. return $this->_mediaProcessorId;
  531. }
  532. /**
  533. * Set "Media procesot id".
  534. *
  535. * @param string $value Media procesot id
  536. */
  537. public function setMediaProcessorId($value)
  538. {
  539. $this->_mediaProcessorId = $value;
  540. }
  541. /**
  542. * Get "Configuration".
  543. *
  544. * @return string
  545. */
  546. public function getConfiguration()
  547. {
  548. return $this->_configuration;
  549. }
  550. /**
  551. * Set "Configuration".
  552. *
  553. * @param string $value Configuration
  554. */
  555. public function setConfiguration($value)
  556. {
  557. $this->_configuration = $value;
  558. }
  559. /**
  560. * Get "ErrorDetails".
  561. *
  562. * @return ErrorDetail[]
  563. */
  564. public function getErrorDetails()
  565. {
  566. return $this->_errorDetails;
  567. }
  568. /**
  569. * Get "HistoricalEvents".
  570. *
  571. * @return TaskHistoricalEvent[]
  572. */
  573. public function getHistoricalEvents()
  574. {
  575. return $this->_historicalEvents;
  576. }
  577. }