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