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