|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Step to create mongo instance on CloudFoundry. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Graviton\Deployment\Steps\CloudFoundry; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @author List of contributors <https://github.com/libgraviton/deploy-scripts/graphs/contributors> |
|
11
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
|
12
|
|
|
* @link http://swisscom.ch |
|
13
|
|
|
*/ |
|
14
|
|
|
final class StepCreateService extends AbstractStep |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
private $applicationName; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private $serviceType; |
|
25
|
|
|
|
|
26
|
|
|
/* |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
private $servicePlan; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
private $serviceName; |
|
35
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* |
|
39
|
|
|
* Note: |
|
40
|
|
|
* use »cf m« to find supported services anf types. |
|
41
|
|
|
* |
|
42
|
|
|
* @param array $configuration Current application configuration. |
|
43
|
|
|
* @param string $applicationName Name of the CF-application to be checked |
|
44
|
|
|
* @param string $serviceType Type of the CF service to create |
|
45
|
|
|
* @param string $servicePlan Plan of the CF service to create |
|
46
|
|
|
* @param string $serviceName Name of the CF service to create, defaults to $serviceType |
|
47
|
|
|
*/ |
|
48
|
5 |
|
public function __construct(array $configuration, $applicationName, $serviceType, $servicePlan, $serviceName = null) |
|
49
|
|
|
{ |
|
50
|
5 |
|
parent::__construct($configuration); |
|
51
|
|
|
|
|
52
|
5 |
|
$this->applicationName = $applicationName; |
|
53
|
5 |
|
$this->serviceType = $serviceType; |
|
54
|
5 |
|
$this->servicePlan = $servicePlan; |
|
55
|
5 |
|
$this->serviceName = $serviceName; |
|
56
|
5 |
|
if (is_null($serviceName)) { |
|
57
|
5 |
|
$this->serviceName = $serviceType; |
|
58
|
5 |
|
} |
|
59
|
5 |
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* returns the command |
|
63
|
|
|
* |
|
64
|
|
|
* @return array |
|
65
|
|
|
*/ |
|
66
|
4 |
|
public function getCommand() |
|
67
|
|
|
{ |
|
68
|
|
|
return array( |
|
69
|
4 |
|
$this->configuration['cf_bin'], |
|
70
|
4 |
|
'cs', |
|
71
|
4 |
|
$this->serviceType, |
|
72
|
4 |
|
$this->servicePlan, |
|
73
|
4 |
|
$this->applicationName . '-' . $this->serviceName |
|
74
|
4 |
|
); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|