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\ListMetricDescriptorsResponse;
|
---|
21 | use Google\Service\Monitoring\MetricDescriptor;
|
---|
22 | use Google\Service\Monitoring\MonitoringEmpty;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "metricDescriptors" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $monitoringService = new Google\Service\Monitoring(...);
|
---|
29 | * $metricDescriptors = $monitoringService->projects_metricDescriptors;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class ProjectsMetricDescriptors extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates a new metric descriptor. The creation is executed asynchronously.
|
---|
36 | * User-created metric descriptors define custom metrics
|
---|
37 | * (https://cloud.google.com/monitoring/custom-metrics). The metric descriptor
|
---|
38 | * is updated if it already exists, except that metric labels are never removed.
|
---|
39 | * (metricDescriptors.create)
|
---|
40 | *
|
---|
41 | * @param string $name Required. The project
|
---|
42 | * (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute
|
---|
43 | * the request. The format is: 4 projects/PROJECT_ID_OR_NUMBER
|
---|
44 | * @param MetricDescriptor $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | * @return MetricDescriptor
|
---|
47 | * @throws \Google\Service\Exception
|
---|
48 | */
|
---|
49 | public function create($name, MetricDescriptor $postBody, $optParams = [])
|
---|
50 | {
|
---|
51 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
52 | $params = array_merge($params, $optParams);
|
---|
53 | return $this->call('create', [$params], MetricDescriptor::class);
|
---|
54 | }
|
---|
55 | /**
|
---|
56 | * Deletes a metric descriptor. Only user-created custom metrics
|
---|
57 | * (https://cloud.google.com/monitoring/custom-metrics) can be deleted.
|
---|
58 | * (metricDescriptors.delete)
|
---|
59 | *
|
---|
60 | * @param string $name Required. The metric descriptor on which to execute the
|
---|
61 | * request. The format is:
|
---|
62 | * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] An example of
|
---|
63 | * [METRIC_ID] is: "custom.googleapis.com/my_test_metric".
|
---|
64 | * @param array $optParams Optional parameters.
|
---|
65 | * @return MonitoringEmpty
|
---|
66 | * @throws \Google\Service\Exception
|
---|
67 | */
|
---|
68 | public function delete($name, $optParams = [])
|
---|
69 | {
|
---|
70 | $params = ['name' => $name];
|
---|
71 | $params = array_merge($params, $optParams);
|
---|
72 | return $this->call('delete', [$params], MonitoringEmpty::class);
|
---|
73 | }
|
---|
74 | /**
|
---|
75 | * Gets a single metric descriptor. (metricDescriptors.get)
|
---|
76 | *
|
---|
77 | * @param string $name Required. The metric descriptor on which to execute the
|
---|
78 | * request. The format is:
|
---|
79 | * projects/[PROJECT_ID_OR_NUMBER]/metricDescriptors/[METRIC_ID] An example
|
---|
80 | * value of [METRIC_ID] is
|
---|
81 | * "compute.googleapis.com/instance/disk/read_bytes_count".
|
---|
82 | * @param array $optParams Optional parameters.
|
---|
83 | * @return MetricDescriptor
|
---|
84 | * @throws \Google\Service\Exception
|
---|
85 | */
|
---|
86 | public function get($name, $optParams = [])
|
---|
87 | {
|
---|
88 | $params = ['name' => $name];
|
---|
89 | $params = array_merge($params, $optParams);
|
---|
90 | return $this->call('get', [$params], MetricDescriptor::class);
|
---|
91 | }
|
---|
92 | /**
|
---|
93 | * Lists metric descriptors that match a filter.
|
---|
94 | * (metricDescriptors.listProjectsMetricDescriptors)
|
---|
95 | *
|
---|
96 | * @param string $name Required. The project
|
---|
97 | * (https://cloud.google.com/monitoring/api/v3#project_name) on which to execute
|
---|
98 | * the request. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
99 | * @param array $optParams Optional parameters.
|
---|
100 | *
|
---|
101 | * @opt_param string filter Optional. If this field is empty, all custom and
|
---|
102 | * system-defined metric descriptors are returned. Otherwise, the filter
|
---|
103 | * (https://cloud.google.com/monitoring/api/v3/filters) specifies which metric
|
---|
104 | * descriptors are to be returned. For example, the following filter matches all
|
---|
105 | * custom metrics (https://cloud.google.com/monitoring/custom-metrics):
|
---|
106 | * metric.type = starts_with("custom.googleapis.com/")
|
---|
107 | * @opt_param int pageSize Optional. A positive number that is the maximum
|
---|
108 | * number of results to return. The default and maximum value is 10,000. If a
|
---|
109 | * page_size <= 0 or > 10,000 is submitted, will instead return a maximum of
|
---|
110 | * 10,000 results.
|
---|
111 | * @opt_param string pageToken Optional. If this field is not empty then it must
|
---|
112 | * contain the nextPageToken value returned by a previous call to this method.
|
---|
113 | * Using this field causes the method to return additional results from the
|
---|
114 | * previous method call.
|
---|
115 | * @return ListMetricDescriptorsResponse
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function listProjectsMetricDescriptors($name, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['name' => $name];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('list', [$params], ListMetricDescriptorsResponse::class);
|
---|
123 | }
|
---|
124 | }
|
---|
125 |
|
---|
126 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
127 | class_alias(ProjectsMetricDescriptors::class, 'Google_Service_Monitoring_Resource_ProjectsMetricDescriptors');
|
---|