|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
|
4
|
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Connector\ClientInterface; |
|
6
|
|
|
use AcquiaCloudApi\Response\ApplicationResponse; |
|
7
|
|
|
use AcquiaCloudApi\Response\ApplicationsResponse; |
|
8
|
|
|
use AcquiaCloudApi\Response\TagResponse; |
|
9
|
|
|
use AcquiaCloudApi\Response\TagsResponse; |
|
10
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Class Applications |
|
14
|
|
|
* @package AcquiaCloudApi\CloudApi |
|
15
|
|
|
*/ |
|
16
|
|
|
class Applications extends CloudApiBase implements CloudApiInterface |
|
17
|
|
|
{ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Shows all applications. |
|
21
|
|
|
* |
|
22
|
|
|
* @return ApplicationsResponse |
|
23
|
|
|
*/ |
|
24
|
|
|
public function getAll() |
|
25
|
|
|
{ |
|
26
|
|
|
return new ApplicationsResponse($this->client->request('get', '/applications')); |
|
|
|
|
|
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Shows information about an application. |
|
31
|
|
|
* |
|
32
|
|
|
* @param string $applicationUuid |
|
33
|
|
|
* @return ApplicationResponse |
|
34
|
|
|
*/ |
|
35
|
|
|
public function get($applicationUuid) |
|
36
|
|
|
{ |
|
37
|
|
|
return new ApplicationResponse( |
|
38
|
|
|
$this->client->request( |
|
|
|
|
|
|
39
|
|
|
'get', |
|
40
|
|
|
"/applications/${applicationUuid}" |
|
41
|
|
|
) |
|
42
|
|
|
); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Renames an application. |
|
47
|
|
|
* |
|
48
|
|
|
* @param string $applicationUuid |
|
49
|
|
|
* @param string $name |
|
50
|
|
|
* @return OperationResponse |
|
51
|
|
|
*/ |
|
52
|
|
|
public function rename($applicationUuid, $name) |
|
53
|
|
|
{ |
|
54
|
|
|
|
|
55
|
|
|
$options = [ |
|
56
|
|
|
'form_params' => [ |
|
57
|
|
|
'name' => $name, |
|
58
|
|
|
], |
|
59
|
|
|
]; |
|
60
|
|
|
|
|
61
|
|
|
return new OperationResponse( |
|
62
|
|
|
$this->client->request( |
|
|
|
|
|
|
63
|
|
|
'put', |
|
64
|
|
|
"/applications/${applicationUuid}", |
|
65
|
|
|
$options |
|
66
|
|
|
) |
|
67
|
|
|
); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Returns a list of application tags associated with this application. |
|
72
|
|
|
* |
|
73
|
|
|
* @param string $applicationUuid |
|
74
|
|
|
* @return TagsResponse |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getAllTags($applicationUuid) |
|
77
|
|
|
{ |
|
78
|
|
|
|
|
79
|
|
|
return new TagsResponse( |
|
80
|
|
|
$this->client->request( |
|
|
|
|
|
|
81
|
|
|
'get', |
|
82
|
|
|
"/applications/${applicationUuid}/tags" |
|
83
|
|
|
) |
|
84
|
|
|
); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Creates a new application tag. |
|
89
|
|
|
* |
|
90
|
|
|
* @param string $applicationUuid |
|
91
|
|
|
* @param string $name |
|
92
|
|
|
* @param string $color |
|
93
|
|
|
* @return OperationResponse |
|
94
|
|
|
*/ |
|
95
|
|
|
public function createTag($applicationUuid, $name, $color) |
|
96
|
|
|
{ |
|
97
|
|
|
|
|
98
|
|
|
$options = [ |
|
99
|
|
|
'form_params' => [ |
|
100
|
|
|
'name' => $name, |
|
101
|
|
|
'color' => $color, |
|
102
|
|
|
], |
|
103
|
|
|
]; |
|
104
|
|
|
|
|
105
|
|
|
return new OperationResponse( |
|
106
|
|
|
$this->client->request( |
|
|
|
|
|
|
107
|
|
|
'post', |
|
108
|
|
|
"/applications/${applicationUuid}/tags", |
|
109
|
|
|
$options |
|
110
|
|
|
) |
|
111
|
|
|
); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Deletes an application tag. |
|
116
|
|
|
* |
|
117
|
|
|
* @param string $applicationUuid |
|
118
|
|
|
* @param string $tagName |
|
119
|
|
|
* @return OperationResponse |
|
120
|
|
|
*/ |
|
121
|
|
|
public function deleteTag($applicationUuid, $tagName) |
|
122
|
|
|
{ |
|
123
|
|
|
|
|
124
|
|
|
return new OperationResponse( |
|
125
|
|
|
$this->client->request( |
|
|
|
|
|
|
126
|
|
|
'delete', |
|
127
|
|
|
"/applications/${applicationUuid}/tags/${tagName}" |
|
128
|
|
|
) |
|
129
|
|
|
); |
|
130
|
|
|
} |
|
131
|
|
|
} |
|
132
|
|
|
|