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