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\Group;
|
---|
21 | use Google\Service\Monitoring\ListGroupsResponse;
|
---|
22 | use Google\Service\Monitoring\MonitoringEmpty;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "groups" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $monitoringService = new Google\Service\Monitoring(...);
|
---|
29 | * $groups = $monitoringService->projects_groups;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class ProjectsGroups extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates a new group. (groups.create)
|
---|
36 | *
|
---|
37 | * @param string $name Required. The project
|
---|
38 | * (https://cloud.google.com/monitoring/api/v3#project_name) in which to create
|
---|
39 | * the group. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
40 | * @param Group $postBody
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | *
|
---|
43 | * @opt_param bool validateOnly If true, validate this request but do not create
|
---|
44 | * the group.
|
---|
45 | * @return Group
|
---|
46 | * @throws \Google\Service\Exception
|
---|
47 | */
|
---|
48 | public function create($name, Group $postBody, $optParams = [])
|
---|
49 | {
|
---|
50 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
51 | $params = array_merge($params, $optParams);
|
---|
52 | return $this->call('create', [$params], Group::class);
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Deletes an existing group. (groups.delete)
|
---|
56 | *
|
---|
57 | * @param string $name Required. The group to delete. The format is:
|
---|
58 | * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
---|
59 | * @param array $optParams Optional parameters.
|
---|
60 | *
|
---|
61 | * @opt_param bool recursive If this field is true, then the request means to
|
---|
62 | * delete a group with all its descendants. Otherwise, the request means to
|
---|
63 | * delete a group only when it has no descendants. The default value is false.
|
---|
64 | * @return MonitoringEmpty
|
---|
65 | * @throws \Google\Service\Exception
|
---|
66 | */
|
---|
67 | public function delete($name, $optParams = [])
|
---|
68 | {
|
---|
69 | $params = ['name' => $name];
|
---|
70 | $params = array_merge($params, $optParams);
|
---|
71 | return $this->call('delete', [$params], MonitoringEmpty::class);
|
---|
72 | }
|
---|
73 | /**
|
---|
74 | * Gets a single group. (groups.get)
|
---|
75 | *
|
---|
76 | * @param string $name Required. The group to retrieve. The format is:
|
---|
77 | * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID]
|
---|
78 | * @param array $optParams Optional parameters.
|
---|
79 | * @return Group
|
---|
80 | * @throws \Google\Service\Exception
|
---|
81 | */
|
---|
82 | public function get($name, $optParams = [])
|
---|
83 | {
|
---|
84 | $params = ['name' => $name];
|
---|
85 | $params = array_merge($params, $optParams);
|
---|
86 | return $this->call('get', [$params], Group::class);
|
---|
87 | }
|
---|
88 | /**
|
---|
89 | * Lists the existing groups. (groups.listProjectsGroups)
|
---|
90 | *
|
---|
91 | * @param string $name Required. The project
|
---|
92 | * (https://cloud.google.com/monitoring/api/v3#project_name) whose groups are to
|
---|
93 | * be listed. The format is: projects/[PROJECT_ID_OR_NUMBER]
|
---|
94 | * @param array $optParams Optional parameters.
|
---|
95 | *
|
---|
96 | * @opt_param string ancestorsOfGroup A group name. The format is:
|
---|
97 | * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] Returns groups that are
|
---|
98 | * ancestors of the specified group. The groups are returned in order, starting
|
---|
99 | * with the immediate parent and ending with the most distant ancestor. If the
|
---|
100 | * specified group has no immediate parent, the results are empty.
|
---|
101 | * @opt_param string childrenOfGroup A group name. The format is:
|
---|
102 | * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] Returns groups whose
|
---|
103 | * parent_name field contains the group name. If no groups have this parent, the
|
---|
104 | * results are empty.
|
---|
105 | * @opt_param string descendantsOfGroup A group name. The format is:
|
---|
106 | * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] Returns the descendants of
|
---|
107 | * the specified group. This is a superset of the results returned by the
|
---|
108 | * children_of_group filter, and includes children-of-children, and so forth.
|
---|
109 | * @opt_param int pageSize A positive number that is the maximum number of
|
---|
110 | * results to return.
|
---|
111 | * @opt_param string pageToken If this field is not empty then it must contain
|
---|
112 | * the next_page_token value returned by a previous call to this method. Using
|
---|
113 | * this field causes the method to return additional results from the previous
|
---|
114 | * method call.
|
---|
115 | * @return ListGroupsResponse
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function listProjectsGroups($name, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['name' => $name];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('list', [$params], ListGroupsResponse::class);
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * Updates an existing group. You can change any group attributes except name.
|
---|
126 | * (groups.update)
|
---|
127 | *
|
---|
128 | * @param string $name Output only. The name of this group. The format is:
|
---|
129 | * projects/[PROJECT_ID_OR_NUMBER]/groups/[GROUP_ID] When creating a group, this
|
---|
130 | * field is ignored and a new name is created consisting of the project
|
---|
131 | * specified in the call to CreateGroup and a unique [GROUP_ID] that is
|
---|
132 | * generated automatically.
|
---|
133 | * @param Group $postBody
|
---|
134 | * @param array $optParams Optional parameters.
|
---|
135 | *
|
---|
136 | * @opt_param bool validateOnly If true, validate this request but do not update
|
---|
137 | * the existing group.
|
---|
138 | * @return Group
|
---|
139 | * @throws \Google\Service\Exception
|
---|
140 | */
|
---|
141 | public function update($name, Group $postBody, $optParams = [])
|
---|
142 | {
|
---|
143 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
144 | $params = array_merge($params, $optParams);
|
---|
145 | return $this->call('update', [$params], Group::class);
|
---|
146 | }
|
---|
147 | }
|
---|
148 |
|
---|
149 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
150 | class_alias(ProjectsGroups::class, 'Google_Service_Monitoring_Resource_ProjectsGroups');
|
---|