1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
4
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Response\MetricResponse; |
6
|
|
|
use AcquiaCloudApi\Response\MetricsResponse; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class Metrics |
10
|
|
|
* |
11
|
|
|
* @package AcquiaCloudApi\CloudApi |
12
|
|
|
*/ |
13
|
|
|
class Metrics extends CloudApiBase |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* Retrieves aggregate usage data for an application. |
17
|
|
|
* |
18
|
|
|
* @return MetricsResponse<MetricResponse> |
19
|
|
|
*/ |
20
|
|
|
public function getAggregateData(string $applicationUuid): MetricsResponse |
21
|
|
|
{ |
22
|
|
|
return new MetricsResponse( |
23
|
|
|
$this->client->request( |
24
|
|
|
'get', |
25
|
|
|
"/applications/$applicationUuid/metrics/usage/data" |
26
|
|
|
) |
27
|
|
|
); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Retrieves aggregate usage metric data for an application. |
32
|
|
|
*/ |
33
|
|
|
public function getAggregateUsageMetrics(string $applicationUuid, string $usageMetric): MetricResponse |
34
|
|
|
{ |
35
|
|
|
return new MetricResponse( |
36
|
|
|
$this->client->request( |
37
|
|
|
'get', |
38
|
|
|
"/applications/$applicationUuid/metrics/usage/$usageMetric" |
39
|
|
|
) |
40
|
|
|
); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Retrieves usage data for an application, broken down by environment. |
45
|
|
|
* |
46
|
|
|
* @return MetricsResponse<MetricResponse> |
47
|
|
|
*/ |
48
|
|
|
public function getDataByEnvironment(string $applicationUuid): MetricsResponse |
49
|
|
|
{ |
50
|
|
|
return new MetricsResponse( |
51
|
|
|
$this->client->request( |
52
|
|
|
'get', |
53
|
|
|
"/applications/$applicationUuid/metrics/usage/data-by-environment" |
54
|
|
|
) |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Retrieves views data for an application, broken down by environment. |
60
|
|
|
* |
61
|
|
|
* @return MetricsResponse<MetricResponse> |
62
|
|
|
*/ |
63
|
|
|
public function getViewsByEnvironment(string $applicationUuid): MetricsResponse |
64
|
|
|
{ |
65
|
|
|
return new MetricsResponse( |
66
|
|
|
$this->client->request( |
67
|
|
|
'get', |
68
|
|
|
"/applications/$applicationUuid/metrics/usage/views-by-environment" |
69
|
|
|
) |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Retrieves visits data for an application, broken down by environment. |
75
|
|
|
* |
76
|
|
|
* @return MetricsResponse<MetricResponse> |
77
|
|
|
*/ |
78
|
|
|
public function getVisitsByEnvironment(string $applicationUuid): MetricsResponse |
79
|
|
|
{ |
80
|
|
|
return new MetricsResponse( |
81
|
|
|
$this->client->request( |
82
|
|
|
'get', |
83
|
|
|
"/applications/$applicationUuid/metrics/usage/visits-by-environment" |
84
|
|
|
) |
85
|
|
|
); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Returns StackMetrics data for the metrics specified in the filter |
90
|
|
|
* paramater |
91
|
|
|
* (e.g., apache-access, web-cpu). |
92
|
|
|
* |
93
|
|
|
* @return MetricsResponse<MetricResponse> |
94
|
|
|
*/ |
95
|
|
|
public function getStackMetricsData(string $environmentUuid): MetricsResponse |
96
|
|
|
{ |
97
|
|
|
return new MetricsResponse( |
98
|
|
|
$this->client->request( |
99
|
|
|
'get', |
100
|
|
|
"/environments/$environmentUuid/metrics/stackmetrics/data" |
101
|
|
|
) |
102
|
|
|
); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Returns StackMetrics data for the metric (e.g., apache-access). |
107
|
|
|
*/ |
108
|
|
|
public function getStackMetricsDataByMetric(string $environmentUuid, string $metricType): MetricResponse |
109
|
|
|
{ |
110
|
|
|
return new MetricResponse( |
111
|
|
|
$this->client->request( |
112
|
|
|
'get', |
113
|
|
|
"/environments/$environmentUuid/metrics/stackmetrics/$metricType" |
114
|
|
|
) |
115
|
|
|
); |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|