1
|
|
|
<?php |
2
|
|
|
// |
3
|
|
|
// This code and all components (c) Copyright 2006 - 2018, Wowza Media Systems, LLC. All rights reserved. |
4
|
|
|
// This code is licensed pursuant to the Wowza Public License version 1.0, available at www.wowza.com/legal. |
5
|
|
|
// |
6
|
|
|
namespace Com\Wowza; |
7
|
|
|
|
8
|
|
|
use Com\Wowza\Entities\Application\Helpers\Settings; |
9
|
|
|
|
10
|
|
|
class Application extends Wowza |
11
|
|
|
{ |
12
|
|
|
protected $appType = 'Live'; |
13
|
|
|
protected $name = ''; |
14
|
|
|
protected $clientStreamReadAccess = '*'; |
15
|
|
|
protected $clientStreamWriteAccess = '*'; |
16
|
|
|
protected $description = ''; |
17
|
|
|
|
18
|
|
|
public function __construct( |
19
|
|
|
Settings $settings, |
20
|
|
|
$name = 'live', |
21
|
|
|
$appType = 'Live', |
22
|
|
|
$clientStreamReadAccess = '*', |
23
|
|
|
$clientStreamWriteAccess = '*', |
24
|
|
|
$description = '*' |
25
|
|
|
) { |
26
|
|
|
parent::__construct($settings); |
27
|
|
|
$this->name = $name; |
28
|
|
|
$this->appType = $appType; |
29
|
|
|
$this->clientStreamReadAccess = $clientStreamReadAccess; |
30
|
|
|
$this->clientStreamWriteAccess = $clientStreamWriteAccess; |
31
|
|
|
$this->description = $description; |
32
|
|
|
$this->restURI = $this->getHost() . '/servers/' . $this->getServerInstance() . '/vhosts/' . $this->getVHostInstance() . "/applications/{$name}"; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
private function setParameters() |
36
|
|
|
{ |
37
|
|
|
$this->addSkipParameter('name', true) |
38
|
|
|
->addSkipParameter('clientStreamReadAccess', true) |
39
|
|
|
->addSkipParameter('appType', true) |
40
|
|
|
->addSkipParameter('clientStreamWriteAccess', true) |
41
|
|
|
->addSkipParameter('description', true); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function get() |
45
|
|
|
{ |
46
|
|
|
$this->setParameters(); |
47
|
|
|
|
48
|
|
|
$this->restURI = $this->getHost() . '/servers/' . $this->getServerInstance() . '/vhosts/' . $this->getVHostInstance() . "/applications/{$this->name}"; |
49
|
|
|
|
50
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function getAdvanced() |
54
|
|
|
{ |
55
|
|
|
$this->setParameters(); |
56
|
|
|
|
57
|
|
|
$this->restURI = $this->getHost() . '/servers/' . $this->getServerInstance() . '/vhosts/' . $this->getVHostInstance() . "/applications/{$this->name}/adv"; |
58
|
|
|
|
59
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function getAll() |
63
|
|
|
{ |
64
|
|
|
$this->setParameters(); |
65
|
|
|
|
66
|
|
|
$this->restURI = $this->getHost() . '/servers/' . $this->getServerInstance() . '/vhosts/' . $this->getVHostInstance() . '/applications'; |
67
|
|
|
|
68
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_GET); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function create( |
72
|
|
|
Entities\Application\StreamConfig $streamConfig, |
73
|
|
|
Entities\Application\SecurityConfig $securityConfig = null, |
74
|
|
|
Entities\Application\Modules $modules = null, |
75
|
|
|
Entities\Application\DvrConfig $dvrConfig = null, |
76
|
|
|
Entities\Application\TranscoderConfig $transConfig = null, |
77
|
|
|
Entities\Application\DrmConfig $drmConfig = null |
78
|
|
|
) { |
79
|
|
|
$this->restURI = $this->getHost() . '/servers/' . $this->getServerInstance() . '/vhosts/' . $this->getVHostInstance() . "/applications/{$this->name}"; |
80
|
|
|
|
81
|
|
|
$entities = $this->getEntites(func_get_args(), $this->restURI); |
82
|
|
|
|
83
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), $entities); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function update( |
87
|
|
|
Entities\Application\StreamConfig $streamConfig, |
88
|
|
|
Entities\Application\SecurityConfig $securityConfig = null, |
89
|
|
|
Entities\Application\Modules $modules = null, |
90
|
|
|
Entities\Application\DvrConfig $dvrConfig = null, |
91
|
|
|
Entities\Application\TranscoderConfig $transConfig = null, |
92
|
|
|
Entities\Application\DrmConfig $drmConfig = null |
93
|
|
|
) { |
94
|
|
|
$this->restURI = $this->getHost() . '/servers/' . $this->getServerInstance() . '/vhosts/' . $this->getVHostInstance() . "/applications/{$this->name}"; |
95
|
|
|
|
96
|
|
|
$entities = $this->getEntites(func_get_args(), $this->restURI); |
97
|
|
|
|
98
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), $entities, self::VERB_PUT); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function updateAdvanced( |
102
|
|
|
Entities\Application\AdvancedSettings $advancedSettings = null, |
103
|
|
|
Entities\Application\Modules $modules = null |
104
|
|
|
) { |
105
|
|
|
$this->restURI = $this->getHost() . '/servers/' . $this->getServerInstance() . '/vhosts/' . $this->getVHostInstance() . "/applications/{$this->name}"; |
106
|
|
|
|
107
|
|
|
$entities = $this->getEntites(null, $this->restURI); |
108
|
|
|
$props = new \stdClass(); |
109
|
|
|
$props->advancedSettings = $advancedSettings->advancedSettings; |
110
|
|
|
$props->modules = $modules->moduleList; |
111
|
|
|
$props->restURI = $this->restURI . '/adv'; |
112
|
|
|
|
113
|
|
|
return $this->sendRequest($props, $entities, self::VERB_PUT); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function remove() |
117
|
|
|
{ |
118
|
|
|
return $this->sendRequest($this->preparePropertiesForRequest(self::class), [], self::VERB_DELETE); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
public function getRestURI() |
122
|
|
|
{ |
123
|
|
|
return $this->restURI; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public function getName() |
127
|
|
|
{ |
128
|
|
|
return $this->name; |
129
|
|
|
} |
130
|
|
|
} |
131
|
|
|
|