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\Logging\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Logging\ListLogMetricsResponse;
|
---|
21 | use Google\Service\Logging\LogMetric;
|
---|
22 | use Google\Service\Logging\LoggingEmpty;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "metrics" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $loggingService = new Google\Service\Logging(...);
|
---|
29 | * $metrics = $loggingService->projects_metrics;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class ProjectsMetrics extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates a logs-based metric. (metrics.create)
|
---|
36 | *
|
---|
37 | * @param string $parent Required. The resource name of the project in which to
|
---|
38 | * create the metric: "projects/[PROJECT_ID]" The new metric must be provided in
|
---|
39 | * the request.
|
---|
40 | * @param LogMetric $postBody
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | * @return LogMetric
|
---|
43 | * @throws \Google\Service\Exception
|
---|
44 | */
|
---|
45 | public function create($parent, LogMetric $postBody, $optParams = [])
|
---|
46 | {
|
---|
47 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
48 | $params = array_merge($params, $optParams);
|
---|
49 | return $this->call('create', [$params], LogMetric::class);
|
---|
50 | }
|
---|
51 | /**
|
---|
52 | * Deletes a logs-based metric. (metrics.delete)
|
---|
53 | *
|
---|
54 | * @param string $metricName Required. The resource name of the metric to
|
---|
55 | * delete: "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
---|
56 | * @param array $optParams Optional parameters.
|
---|
57 | * @return LoggingEmpty
|
---|
58 | * @throws \Google\Service\Exception
|
---|
59 | */
|
---|
60 | public function delete($metricName, $optParams = [])
|
---|
61 | {
|
---|
62 | $params = ['metricName' => $metricName];
|
---|
63 | $params = array_merge($params, $optParams);
|
---|
64 | return $this->call('delete', [$params], LoggingEmpty::class);
|
---|
65 | }
|
---|
66 | /**
|
---|
67 | * Gets a logs-based metric. (metrics.get)
|
---|
68 | *
|
---|
69 | * @param string $metricName Required. The resource name of the desired metric:
|
---|
70 | * "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
---|
71 | * @param array $optParams Optional parameters.
|
---|
72 | * @return LogMetric
|
---|
73 | * @throws \Google\Service\Exception
|
---|
74 | */
|
---|
75 | public function get($metricName, $optParams = [])
|
---|
76 | {
|
---|
77 | $params = ['metricName' => $metricName];
|
---|
78 | $params = array_merge($params, $optParams);
|
---|
79 | return $this->call('get', [$params], LogMetric::class);
|
---|
80 | }
|
---|
81 | /**
|
---|
82 | * Lists logs-based metrics. (metrics.listProjectsMetrics)
|
---|
83 | *
|
---|
84 | * @param string $parent Required. The name of the project containing the
|
---|
85 | * metrics: "projects/[PROJECT_ID]"
|
---|
86 | * @param array $optParams Optional parameters.
|
---|
87 | *
|
---|
88 | * @opt_param int pageSize Optional. The maximum number of results to return
|
---|
89 | * from this request. Non-positive values are ignored. The presence of
|
---|
90 | * nextPageToken in the response indicates that more results might be available.
|
---|
91 | * @opt_param string pageToken Optional. If present, then retrieve the next
|
---|
92 | * batch of results from the preceding call to this method. pageToken must be
|
---|
93 | * the value of nextPageToken from the previous response. The values of other
|
---|
94 | * method parameters should be identical to those in the previous call.
|
---|
95 | * @return ListLogMetricsResponse
|
---|
96 | * @throws \Google\Service\Exception
|
---|
97 | */
|
---|
98 | public function listProjectsMetrics($parent, $optParams = [])
|
---|
99 | {
|
---|
100 | $params = ['parent' => $parent];
|
---|
101 | $params = array_merge($params, $optParams);
|
---|
102 | return $this->call('list', [$params], ListLogMetricsResponse::class);
|
---|
103 | }
|
---|
104 | /**
|
---|
105 | * Creates or updates a logs-based metric. (metrics.update)
|
---|
106 | *
|
---|
107 | * @param string $metricName Required. The resource name of the metric to
|
---|
108 | * update: "projects/[PROJECT_ID]/metrics/[METRIC_ID]" The updated metric must
|
---|
109 | * be provided in the request and it's name field must be the same as
|
---|
110 | * [METRIC_ID] If the metric does not exist in [PROJECT_ID], then a new metric
|
---|
111 | * is created.
|
---|
112 | * @param LogMetric $postBody
|
---|
113 | * @param array $optParams Optional parameters.
|
---|
114 | * @return LogMetric
|
---|
115 | * @throws \Google\Service\Exception
|
---|
116 | */
|
---|
117 | public function update($metricName, LogMetric $postBody, $optParams = [])
|
---|
118 | {
|
---|
119 | $params = ['metricName' => $metricName, 'postBody' => $postBody];
|
---|
120 | $params = array_merge($params, $optParams);
|
---|
121 | return $this->call('update', [$params], LogMetric::class);
|
---|
122 | }
|
---|
123 | }
|
---|
124 |
|
---|
125 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
126 | class_alias(ProjectsMetrics::class, 'Google_Service_Logging_Resource_ProjectsMetrics');
|
---|