|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
|
4
|
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Connector\ClientInterface; |
|
6
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
|
7
|
|
|
use AcquiaCloudApi\Response\LogForwardingDestinationsResponse; |
|
8
|
|
|
use AcquiaCloudApi\Response\LogForwardingDestinationResponse; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class LogForwardingDestinations |
|
12
|
|
|
* @package AcquiaCloudApi\CloudApi |
|
13
|
|
|
*/ |
|
14
|
|
|
class LogForwardingDestinations extends CloudApiBase implements CloudApiInterface |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Returns a list of log forwarding destinations. |
|
19
|
|
|
* |
|
20
|
|
|
* @param string $environmentUuid The environment ID |
|
21
|
|
|
* @return LogForwardingDestinationsResponse |
|
22
|
|
|
*/ |
|
23
|
|
|
public function getAll($environmentUuid) |
|
24
|
|
|
{ |
|
25
|
|
|
return new LogForwardingDestinationsResponse( |
|
26
|
|
|
$this->client->request( |
|
|
|
|
|
|
27
|
|
|
'get', |
|
28
|
|
|
"/environments/${environmentUuid}/log-forwarding-destinations" |
|
29
|
|
|
) |
|
30
|
|
|
); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Returns a specific log forwarding destination. |
|
35
|
|
|
* |
|
36
|
|
|
* @param string $environmentUuid The environment ID |
|
37
|
|
|
* @param int $destinationId |
|
38
|
|
|
* @return LogForwardingDestinationResponse |
|
39
|
|
|
*/ |
|
40
|
|
|
public function get($environmentUuid, $destinationId) |
|
41
|
|
|
{ |
|
42
|
|
|
return new LogForwardingDestinationResponse( |
|
43
|
|
|
$this->client->request( |
|
|
|
|
|
|
44
|
|
|
'get', |
|
45
|
|
|
"/environments/${environmentUuid}/log-forwarding-destinations/${destinationId}" |
|
46
|
|
|
) |
|
47
|
|
|
); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Creates a log forwarding destination. |
|
52
|
|
|
* |
|
53
|
|
|
* @param string $environmentUuid |
|
54
|
|
|
* @param string $label |
|
55
|
|
|
* @param array $sources |
|
56
|
|
|
* @param string $consumer |
|
57
|
|
|
* @param array $credentials |
|
58
|
|
|
* @param string $address |
|
59
|
|
|
* @return OperationResponse |
|
60
|
|
|
*/ |
|
61
|
|
|
public function create($environmentUuid, $label, $sources, $consumer, $credentials, $address) |
|
62
|
|
|
{ |
|
63
|
|
|
|
|
64
|
|
|
$options = [ |
|
65
|
|
|
'form_params' => [ |
|
66
|
|
|
'label' => $label, |
|
67
|
|
|
'sources' => $sources, |
|
68
|
|
|
'consumer' => $consumer, |
|
69
|
|
|
'credentials' => $credentials, |
|
70
|
|
|
'address' => $address |
|
71
|
|
|
], |
|
72
|
|
|
]; |
|
73
|
|
|
|
|
74
|
|
|
return new OperationResponse( |
|
75
|
|
|
$this->client->request('post', "/environments/${environmentUuid}/log-forwarding-destinations", $options) |
|
|
|
|
|
|
76
|
|
|
); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Delete a specific log forwarding destination. |
|
81
|
|
|
* |
|
82
|
|
|
* @param string $environmentUuid |
|
83
|
|
|
* @param int $destId |
|
84
|
|
|
* @return OperationResponse |
|
85
|
|
|
*/ |
|
86
|
|
|
public function delete($environmentUuid, $destId) |
|
87
|
|
|
{ |
|
88
|
|
|
return new OperationResponse( |
|
89
|
|
|
$this->client->request('delete', "/environments/${environmentUuid}/log-forwarding-destinations/${destId}") |
|
|
|
|
|
|
90
|
|
|
); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Disables a log forwarding destination. |
|
95
|
|
|
* |
|
96
|
|
|
* @param string $environmentUuid |
|
97
|
|
|
* @param int $destId |
|
98
|
|
|
* @return OperationResponse |
|
99
|
|
|
*/ |
|
100
|
|
|
public function disable($environmentUuid, $destId) |
|
101
|
|
|
{ |
|
102
|
|
|
return new OperationResponse( |
|
103
|
|
|
$this->client->request( |
|
|
|
|
|
|
104
|
|
|
'post', |
|
105
|
|
|
"/environments/${environmentUuid}/log-forwarding-destinations/${destId}/actions/disable" |
|
106
|
|
|
) |
|
107
|
|
|
); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Enables a log forwarding destination. |
|
112
|
|
|
* |
|
113
|
|
|
* @param string $environmentUuid |
|
114
|
|
|
* @param int $destId |
|
115
|
|
|
* @return OperationResponse |
|
116
|
|
|
*/ |
|
117
|
|
|
public function enable($environmentUuid, $destId) |
|
118
|
|
|
{ |
|
119
|
|
|
return new OperationResponse( |
|
120
|
|
|
$this->client->request( |
|
|
|
|
|
|
121
|
|
|
'post', |
|
122
|
|
|
"/environments/${environmentUuid}/log-forwarding-destinations/${destId}/actions/enable" |
|
123
|
|
|
) |
|
124
|
|
|
); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Updates a log forwarding destination. |
|
129
|
|
|
* |
|
130
|
|
|
* @param string $environmentUuid |
|
131
|
|
|
* @param int $destId |
|
132
|
|
|
* @param string $label |
|
133
|
|
|
* @param array $sources |
|
134
|
|
|
* @param string $consumer |
|
135
|
|
|
* @param array $creds |
|
136
|
|
|
* @param string $address |
|
137
|
|
|
* @return OperationResponse |
|
138
|
|
|
*/ |
|
139
|
|
|
public function update($environmentUuid, $destId, $label, $sources, $consumer, $creds, $address) |
|
140
|
|
|
{ |
|
141
|
|
|
|
|
142
|
|
|
$options = [ |
|
143
|
|
|
'form_params' => [ |
|
144
|
|
|
'label' => $label, |
|
145
|
|
|
'sources' => $sources, |
|
146
|
|
|
'consumer' => $consumer, |
|
147
|
|
|
'credentials' => $creds, |
|
148
|
|
|
'address' => $address |
|
149
|
|
|
], |
|
150
|
|
|
]; |
|
151
|
|
|
|
|
152
|
|
|
return new OperationResponse( |
|
153
|
|
|
$this->client->request( |
|
|
|
|
|
|
154
|
|
|
'put', |
|
155
|
|
|
"/environments/${environmentUuid}/log-forwarding-destinations/${destId}", |
|
156
|
|
|
$options |
|
157
|
|
|
) |
|
158
|
|
|
); |
|
159
|
|
|
} |
|
160
|
|
|
} |
|
161
|
|
|
|