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\ListSnoozesResponse;
|
---|
21 | use Google\Service\Monitoring\Snooze;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "snoozes" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $monitoringService = new Google\Service\Monitoring(...);
|
---|
28 | * $snoozes = $monitoringService->projects_snoozes;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class ProjectsSnoozes extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Creates a Snooze that will prevent alerts, which match the provided criteria,
|
---|
35 | * from being opened. The Snooze applies for a specific time interval.
|
---|
36 | * (snoozes.create)
|
---|
37 | *
|
---|
38 | * @param string $parent Required. The project
|
---|
39 | * (https://cloud.google.com/monitoring/api/v3#project_name) in which a Snooze
|
---|
40 | * should be created. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
41 | * @param Snooze $postBody
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | * @return Snooze
|
---|
44 | * @throws \Google\Service\Exception
|
---|
45 | */
|
---|
46 | public function create($parent, Snooze $postBody, $optParams = [])
|
---|
47 | {
|
---|
48 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
49 | $params = array_merge($params, $optParams);
|
---|
50 | return $this->call('create', [$params], Snooze::class);
|
---|
51 | }
|
---|
52 | /**
|
---|
53 | * Retrieves a Snooze by name. (snoozes.get)
|
---|
54 | *
|
---|
55 | * @param string $name Required. The ID of the Snooze to retrieve. The format
|
---|
56 | * is: projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID]
|
---|
57 | * @param array $optParams Optional parameters.
|
---|
58 | * @return Snooze
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function get($name, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['name' => $name];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('get', [$params], Snooze::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Lists the Snoozes associated with a project. Can optionally pass in filter,
|
---|
69 | * which specifies predicates to match Snoozes. (snoozes.listProjectsSnoozes)
|
---|
70 | *
|
---|
71 | * @param string $parent Required. The project
|
---|
72 | * (https://cloud.google.com/monitoring/api/v3#project_name) whose Snoozes
|
---|
73 | * should be listed. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
74 | * @param array $optParams Optional parameters.
|
---|
75 | *
|
---|
76 | * @opt_param string filter Optional. Optional filter to restrict results to the
|
---|
77 | * given criteria. The following fields are supported. interval.start_time
|
---|
78 | * interval.end_timeFor example: ``` interval.start_time >
|
---|
79 | * "2022-03-11T00:00:00-08:00" AND interval.end_time <
|
---|
80 | * "2022-03-12T00:00:00-08:00" ```
|
---|
81 | * @opt_param int pageSize Optional. The maximum number of results to return for
|
---|
82 | * a single query. The server may further constrain the maximum number of
|
---|
83 | * results returned in a single page. The value should be in the range 1, 1000.
|
---|
84 | * If the value given is outside this range, the server will decide the number
|
---|
85 | * of results to be returned.
|
---|
86 | * @opt_param string pageToken Optional. The next_page_token from a previous
|
---|
87 | * call to ListSnoozesRequest to get the next page of results.
|
---|
88 | * @return ListSnoozesResponse
|
---|
89 | * @throws \Google\Service\Exception
|
---|
90 | */
|
---|
91 | public function listProjectsSnoozes($parent, $optParams = [])
|
---|
92 | {
|
---|
93 | $params = ['parent' => $parent];
|
---|
94 | $params = array_merge($params, $optParams);
|
---|
95 | return $this->call('list', [$params], ListSnoozesResponse::class);
|
---|
96 | }
|
---|
97 | /**
|
---|
98 | * Updates a Snooze, identified by its name, with the parameters in the given
|
---|
99 | * Snooze object. (snoozes.patch)
|
---|
100 | *
|
---|
101 | * @param string $name Required. Identifier. The name of the Snooze. The format
|
---|
102 | * is: projects/[PROJECT_ID_OR_NUMBER]/snoozes/[SNOOZE_ID] The ID of the Snooze
|
---|
103 | * will be generated by the system.
|
---|
104 | * @param Snooze $postBody
|
---|
105 | * @param array $optParams Optional parameters.
|
---|
106 | *
|
---|
107 | * @opt_param string updateMask Required. The fields to update.For each field
|
---|
108 | * listed in update_mask: If the Snooze object supplied in the
|
---|
109 | * UpdateSnoozeRequest has a value for that field, the value of the field in the
|
---|
110 | * existing Snooze will be set to the value of the field in the supplied Snooze.
|
---|
111 | * If the field does not have a value in the supplied Snooze, the field in the
|
---|
112 | * existing Snooze is set to its default value.Fields not listed retain their
|
---|
113 | * existing value.The following are the field names that are accepted in
|
---|
114 | * update_mask: display_name interval.start_time interval.end_timeThat said, the
|
---|
115 | * start time and end time of the Snooze determines which fields can legally be
|
---|
116 | * updated. Before attempting an update, users should consult the documentation
|
---|
117 | * for UpdateSnoozeRequest, which talks about which fields can be updated.
|
---|
118 | * @return Snooze
|
---|
119 | * @throws \Google\Service\Exception
|
---|
120 | */
|
---|
121 | public function patch($name, Snooze $postBody, $optParams = [])
|
---|
122 | {
|
---|
123 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
124 | $params = array_merge($params, $optParams);
|
---|
125 | return $this->call('patch', [$params], Snooze::class);
|
---|
126 | }
|
---|
127 | }
|
---|
128 |
|
---|
129 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
130 | class_alias(ProjectsSnoozes::class, 'Google_Service_Monitoring_Resource_ProjectsSnoozes');
|
---|