1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\Monitoring\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Monitoring\CreateTimeSeriesRequest;
|
---|
21 | use Google\Service\Monitoring\ListTimeSeriesResponse;
|
---|
22 | use Google\Service\Monitoring\MonitoringEmpty;
|
---|
23 | use Google\Service\Monitoring\QueryTimeSeriesRequest;
|
---|
24 | use Google\Service\Monitoring\QueryTimeSeriesResponse;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The "timeSeries" collection of methods.
|
---|
28 | * Typical usage is:
|
---|
29 | * <code>
|
---|
30 | * $monitoringService = new Google\Service\Monitoring(...);
|
---|
31 | * $timeSeries = $monitoringService->projects_timeSeries;
|
---|
32 | * </code>
|
---|
33 | */
|
---|
34 | class ProjectsTimeSeries extends \Google\Service\Resource
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * Creates or adds data to one or more time series. The response is empty if all
|
---|
38 | * time series in the request were written. If any time series could not be
|
---|
39 | * written, a corresponding failure message is included in the error response.
|
---|
40 | * This method does not support resource locations constraint of an organization
|
---|
41 | * policy (https://cloud.google.com/resource-manager/docs/organization-
|
---|
42 | * policy/defining-locations#setting_the_organization_policy).
|
---|
43 | * (timeSeries.create)
|
---|
44 | *
|
---|
45 | * @param string $name Required. The project
|
---|
46 | * (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute
|
---|
47 | * the request. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
48 | * @param CreateTimeSeriesRequest $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return MonitoringEmpty
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function create($name, CreateTimeSeriesRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('create', [$params], MonitoringEmpty::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Creates or adds data to one or more service time series. A service time
|
---|
61 | * series is a time series for a metric from a Google Cloud service. The
|
---|
62 | * response is empty if all time series in the request were written. If any time
|
---|
63 | * series could not be written, a corresponding failure message is included in
|
---|
64 | * the error response. This endpoint rejects writes to user-defined metrics.
|
---|
65 | * This method is only for use by Google Cloud services. Use
|
---|
66 | * projects.timeSeries.create instead. (timeSeries.createService)
|
---|
67 | *
|
---|
68 | * @param string $name Required. The project
|
---|
69 | * (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute
|
---|
70 | * the request. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
71 | * @param CreateTimeSeriesRequest $postBody
|
---|
72 | * @param array $optParams Optional parameters.
|
---|
73 | * @return MonitoringEmpty
|
---|
74 | * @throws \Google\Service\Exception
|
---|
75 | */
|
---|
76 | public function createService($name, CreateTimeSeriesRequest $postBody, $optParams = [])
|
---|
77 | {
|
---|
78 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
79 | $params = array_merge($params, $optParams);
|
---|
80 | return $this->call('createService', [$params], MonitoringEmpty::class);
|
---|
81 | }
|
---|
82 | /**
|
---|
83 | * Lists time series that match a filter. (timeSeries.listProjectsTimeSeries)
|
---|
84 | *
|
---|
85 | * @param string $name Required. The project
|
---|
86 | * (https://cloud.google.com/monitoring/api/v3#project_name), organization or
|
---|
87 | * folder on which to execute the request. The format is:
|
---|
88 | * projects/[PROJECT_ID_OR_NUMBER] organizations/[ORGANIZATION_ID]
|
---|
89 | * folders/[FOLDER_ID]
|
---|
90 | * @param array $optParams Optional parameters.
|
---|
91 | *
|
---|
92 | * @opt_param string aggregation.alignmentPeriod The alignment_period specifies
|
---|
93 | * a time interval, in seconds, that is used to divide the data in all the time
|
---|
94 | * series into consistent blocks of time. This will be done before the per-
|
---|
95 | * series aligner can be applied to the data.The value must be at least 60
|
---|
96 | * seconds. If a per-series aligner other than ALIGN_NONE is specified, this
|
---|
97 | * field is required or an error is returned. If no per-series aligner is
|
---|
98 | * specified, or the aligner ALIGN_NONE is specified, then this field is
|
---|
99 | * ignored.The maximum value of the alignment_period is 104 weeks (2 years) for
|
---|
100 | * charts, and 90,000 seconds (25 hours) for alerting policies.
|
---|
101 | * @opt_param string aggregation.crossSeriesReducer The reduction operation to
|
---|
102 | * be used to combine time series into a single time series, where the value of
|
---|
103 | * each data point in the resulting series is a function of all the already
|
---|
104 | * aligned values in the input time series.Not all reducer operations can be
|
---|
105 | * applied to all time series. The valid choices depend on the metric_kind and
|
---|
106 | * the value_type of the original time series. Reduction can yield a time series
|
---|
107 | * with a different metric_kind or value_type than the input time series.Time
|
---|
108 | * series data must first be aligned (see per_series_aligner) in order to
|
---|
109 | * perform cross-time series reduction. If cross_series_reducer is specified,
|
---|
110 | * then per_series_aligner must be specified, and must not be ALIGN_NONE. An
|
---|
111 | * alignment_period must also be specified; otherwise, an error is returned.
|
---|
112 | * @opt_param string aggregation.groupByFields The set of fields to preserve
|
---|
113 | * when cross_series_reducer is specified. The group_by_fields determine how the
|
---|
114 | * time series are partitioned into subsets prior to applying the aggregation
|
---|
115 | * operation. Each subset contains time series that have the same value for each
|
---|
116 | * of the grouping fields. Each individual time series is a member of exactly
|
---|
117 | * one subset. The cross_series_reducer is applied to each subset of time
|
---|
118 | * series. It is not possible to reduce across different resource types, so this
|
---|
119 | * field implicitly contains resource.type. Fields not specified in
|
---|
120 | * group_by_fields are aggregated away. If group_by_fields is not specified and
|
---|
121 | * all the time series have the same resource type, then the time series are
|
---|
122 | * aggregated into a single output time series. If cross_series_reducer is not
|
---|
123 | * defined, this field is ignored.
|
---|
124 | * @opt_param string aggregation.perSeriesAligner An Aligner describes how to
|
---|
125 | * bring the data points in a single time series into temporal alignment. Except
|
---|
126 | * for ALIGN_NONE, all alignments cause all the data points in an
|
---|
127 | * alignment_period to be mathematically grouped together, resulting in a single
|
---|
128 | * data point for each alignment_period with end timestamp at the end of the
|
---|
129 | * period.Not all alignment operations may be applied to all time series. The
|
---|
130 | * valid choices depend on the metric_kind and value_type of the original time
|
---|
131 | * series. Alignment can change the metric_kind or the value_type of the time
|
---|
132 | * series.Time series data must be aligned in order to perform cross-time series
|
---|
133 | * reduction. If cross_series_reducer is specified, then per_series_aligner must
|
---|
134 | * be specified and not equal to ALIGN_NONE and alignment_period must be
|
---|
135 | * specified; otherwise, an error is returned.
|
---|
136 | * @opt_param string filter Required. A monitoring filter
|
---|
137 | * (https://cloud.google.com/monitoring/api/v3/filters) that specifies which
|
---|
138 | * time series should be returned. The filter must specify a single metric type,
|
---|
139 | * and can additionally specify metric labels and other information. For
|
---|
140 | * example: metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
|
---|
141 | * metric.labels.instance_name = "my-instance-name"
|
---|
142 | * @opt_param string interval.endTime Required. The end of the time interval.
|
---|
143 | * @opt_param string interval.startTime Optional. The beginning of the time
|
---|
144 | * interval. The default value for the start time is the end time. The start
|
---|
145 | * time must not be later than the end time.
|
---|
146 | * @opt_param string orderBy Unsupported: must be left blank. The points in each
|
---|
147 | * time series are currently returned in reverse time order (most recent to
|
---|
148 | * oldest).
|
---|
149 | * @opt_param int pageSize A positive number that is the maximum number of
|
---|
150 | * results to return. If page_size is empty or more than 100,000 results, the
|
---|
151 | * effective page_size is 100,000 results. If view is set to FULL, this is the
|
---|
152 | * maximum number of Points returned. If view is set to HEADERS, this is the
|
---|
153 | * maximum number of TimeSeries returned.
|
---|
154 | * @opt_param string pageToken If this field is not empty then it must contain
|
---|
155 | * the nextPageToken value returned by a previous call to this method. Using
|
---|
156 | * this field causes the method to return additional results from the previous
|
---|
157 | * method call.
|
---|
158 | * @opt_param string secondaryAggregation.alignmentPeriod The alignment_period
|
---|
159 | * specifies a time interval, in seconds, that is used to divide the data in all
|
---|
160 | * the time series into consistent blocks of time. This will be done before the
|
---|
161 | * per-series aligner can be applied to the data.The value must be at least 60
|
---|
162 | * seconds. If a per-series aligner other than ALIGN_NONE is specified, this
|
---|
163 | * field is required or an error is returned. If no per-series aligner is
|
---|
164 | * specified, or the aligner ALIGN_NONE is specified, then this field is
|
---|
165 | * ignored.The maximum value of the alignment_period is 104 weeks (2 years) for
|
---|
166 | * charts, and 90,000 seconds (25 hours) for alerting policies.
|
---|
167 | * @opt_param string secondaryAggregation.crossSeriesReducer The reduction
|
---|
168 | * operation to be used to combine time series into a single time series, where
|
---|
169 | * the value of each data point in the resulting series is a function of all the
|
---|
170 | * already aligned values in the input time series.Not all reducer operations
|
---|
171 | * can be applied to all time series. The valid choices depend on the
|
---|
172 | * metric_kind and the value_type of the original time series. Reduction can
|
---|
173 | * yield a time series with a different metric_kind or value_type than the input
|
---|
174 | * time series.Time series data must first be aligned (see per_series_aligner)
|
---|
175 | * in order to perform cross-time series reduction. If cross_series_reducer is
|
---|
176 | * specified, then per_series_aligner must be specified, and must not be
|
---|
177 | * ALIGN_NONE. An alignment_period must also be specified; otherwise, an error
|
---|
178 | * is returned.
|
---|
179 | * @opt_param string secondaryAggregation.groupByFields The set of fields to
|
---|
180 | * preserve when cross_series_reducer is specified. The group_by_fields
|
---|
181 | * determine how the time series are partitioned into subsets prior to applying
|
---|
182 | * the aggregation operation. Each subset contains time series that have the
|
---|
183 | * same value for each of the grouping fields. Each individual time series is a
|
---|
184 | * member of exactly one subset. The cross_series_reducer is applied to each
|
---|
185 | * subset of time series. It is not possible to reduce across different resource
|
---|
186 | * types, so this field implicitly contains resource.type. Fields not specified
|
---|
187 | * in group_by_fields are aggregated away. If group_by_fields is not specified
|
---|
188 | * and all the time series have the same resource type, then the time series are
|
---|
189 | * aggregated into a single output time series. If cross_series_reducer is not
|
---|
190 | * defined, this field is ignored.
|
---|
191 | * @opt_param string secondaryAggregation.perSeriesAligner An Aligner describes
|
---|
192 | * how to bring the data points in a single time series into temporal alignment.
|
---|
193 | * Except for ALIGN_NONE, all alignments cause all the data points in an
|
---|
194 | * alignment_period to be mathematically grouped together, resulting in a single
|
---|
195 | * data point for each alignment_period with end timestamp at the end of the
|
---|
196 | * period.Not all alignment operations may be applied to all time series. The
|
---|
197 | * valid choices depend on the metric_kind and value_type of the original time
|
---|
198 | * series. Alignment can change the metric_kind or the value_type of the time
|
---|
199 | * series.Time series data must be aligned in order to perform cross-time series
|
---|
200 | * reduction. If cross_series_reducer is specified, then per_series_aligner must
|
---|
201 | * be specified and not equal to ALIGN_NONE and alignment_period must be
|
---|
202 | * specified; otherwise, an error is returned.
|
---|
203 | * @opt_param string view Required. Specifies which information is returned
|
---|
204 | * about the time series.
|
---|
205 | * @return ListTimeSeriesResponse
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function listProjectsTimeSeries($name, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['name' => $name];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('list', [$params], ListTimeSeriesResponse::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Queries time series by using Monitoring Query Language (MQL). We recommend
|
---|
216 | * using PromQL instead of MQL. For more information about the status of MQL,
|
---|
217 | * see the MQL deprecation notice
|
---|
218 | * (https://cloud.google.com/stackdriver/docs/deprecations/mql).
|
---|
219 | * (timeSeries.query)
|
---|
220 | *
|
---|
221 | * @param string $name Required. The project
|
---|
222 | * (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute
|
---|
223 | * the request. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
224 | * @param QueryTimeSeriesRequest $postBody
|
---|
225 | * @param array $optParams Optional parameters.
|
---|
226 | * @return QueryTimeSeriesResponse
|
---|
227 | * @throws \Google\Service\Exception
|
---|
228 | */
|
---|
229 | public function query($name, QueryTimeSeriesRequest $postBody, $optParams = [])
|
---|
230 | {
|
---|
231 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
232 | $params = array_merge($params, $optParams);
|
---|
233 | return $this->call('query', [$params], QueryTimeSeriesResponse::class);
|
---|
234 | }
|
---|
235 | }
|
---|
236 |
|
---|
237 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
238 | class_alias(ProjectsTimeSeries::class, 'Google_Service_Monitoring_Resource_ProjectsTimeSeries');
|
---|