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\CloudAsset\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudAsset\CloudassetEmpty;
|
---|
21 | use Google\Service\CloudAsset\ListSavedQueriesResponse;
|
---|
22 | use Google\Service\CloudAsset\SavedQuery;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "savedQueries" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $cloudassetService = new Google\Service\CloudAsset(...);
|
---|
29 | * $savedQueries = $cloudassetService->savedQueries;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class SavedQueries extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Creates a saved query in a parent project/folder/organization.
|
---|
36 | * (savedQueries.create)
|
---|
37 | *
|
---|
38 | * @param string $parent Required. The name of the project/folder/organization
|
---|
39 | * where this saved_query should be created in. It can only be an organization
|
---|
40 | * number (such as "organizations/123"), a folder number (such as
|
---|
41 | * "folders/123"), a project ID (such as "projects/my-project-id"), or a project
|
---|
42 | * number (such as "projects/12345").
|
---|
43 | * @param SavedQuery $postBody
|
---|
44 | * @param array $optParams Optional parameters.
|
---|
45 | *
|
---|
46 | * @opt_param string savedQueryId Required. The ID to use for the saved query,
|
---|
47 | * which must be unique in the specified parent. It will become the final
|
---|
48 | * component of the saved query's resource name. This value should be 4-63
|
---|
49 | * characters, and valid characters are `a-z-`. Notice that this field is
|
---|
50 | * required in the saved query creation, and the `name` field of the
|
---|
51 | * `saved_query` will be ignored.
|
---|
52 | * @return SavedQuery
|
---|
53 | * @throws \Google\Service\Exception
|
---|
54 | */
|
---|
55 | public function create($parent, SavedQuery $postBody, $optParams = [])
|
---|
56 | {
|
---|
57 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
58 | $params = array_merge($params, $optParams);
|
---|
59 | return $this->call('create', [$params], SavedQuery::class);
|
---|
60 | }
|
---|
61 | /**
|
---|
62 | * Deletes a saved query. (savedQueries.delete)
|
---|
63 | *
|
---|
64 | * @param string $name Required. The name of the saved query to delete. It must
|
---|
65 | * be in the format of: * projects/project_number/savedQueries/saved_query_id *
|
---|
66 | * folders/folder_number/savedQueries/saved_query_id *
|
---|
67 | * organizations/organization_number/savedQueries/saved_query_id
|
---|
68 | * @param array $optParams Optional parameters.
|
---|
69 | * @return CloudassetEmpty
|
---|
70 | * @throws \Google\Service\Exception
|
---|
71 | */
|
---|
72 | public function delete($name, $optParams = [])
|
---|
73 | {
|
---|
74 | $params = ['name' => $name];
|
---|
75 | $params = array_merge($params, $optParams);
|
---|
76 | return $this->call('delete', [$params], CloudassetEmpty::class);
|
---|
77 | }
|
---|
78 | /**
|
---|
79 | * Gets details about a saved query. (savedQueries.get)
|
---|
80 | *
|
---|
81 | * @param string $name Required. The name of the saved query and it must be in
|
---|
82 | * the format of: * projects/project_number/savedQueries/saved_query_id *
|
---|
83 | * folders/folder_number/savedQueries/saved_query_id *
|
---|
84 | * organizations/organization_number/savedQueries/saved_query_id
|
---|
85 | * @param array $optParams Optional parameters.
|
---|
86 | * @return SavedQuery
|
---|
87 | * @throws \Google\Service\Exception
|
---|
88 | */
|
---|
89 | public function get($name, $optParams = [])
|
---|
90 | {
|
---|
91 | $params = ['name' => $name];
|
---|
92 | $params = array_merge($params, $optParams);
|
---|
93 | return $this->call('get', [$params], SavedQuery::class);
|
---|
94 | }
|
---|
95 | /**
|
---|
96 | * Lists all saved queries in a parent project/folder/organization.
|
---|
97 | * (savedQueries.listSavedQueries)
|
---|
98 | *
|
---|
99 | * @param string $parent Required. The parent project/folder/organization whose
|
---|
100 | * savedQueries are to be listed. It can only be using
|
---|
101 | * project/folder/organization number (such as "folders/12345")", or a project
|
---|
102 | * ID (such as "projects/my-project-id").
|
---|
103 | * @param array $optParams Optional parameters.
|
---|
104 | *
|
---|
105 | * @opt_param string filter Optional. The expression to filter resources. The
|
---|
106 | * expression is a list of zero or more restrictions combined via logical
|
---|
107 | * operators `AND` and `OR`. When `AND` and `OR` are both used in the
|
---|
108 | * expression, parentheses must be appropriately used to group the combinations.
|
---|
109 | * The expression may also contain regular expressions. See
|
---|
110 | * https://google.aip.dev/160 for more information on the grammar.
|
---|
111 | * @opt_param int pageSize Optional. The maximum number of saved queries to
|
---|
112 | * return per page. The service may return fewer than this value. If
|
---|
113 | * unspecified, at most 50 will be returned. The maximum value is 1000; values
|
---|
114 | * above 1000 will be coerced to 1000.
|
---|
115 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
116 | * `ListSavedQueries` call. Provide this to retrieve the subsequent page. When
|
---|
117 | * paginating, all other parameters provided to `ListSavedQueries` must match
|
---|
118 | * the call that provided the page token.
|
---|
119 | * @return ListSavedQueriesResponse
|
---|
120 | * @throws \Google\Service\Exception
|
---|
121 | */
|
---|
122 | public function listSavedQueries($parent, $optParams = [])
|
---|
123 | {
|
---|
124 | $params = ['parent' => $parent];
|
---|
125 | $params = array_merge($params, $optParams);
|
---|
126 | return $this->call('list', [$params], ListSavedQueriesResponse::class);
|
---|
127 | }
|
---|
128 | /**
|
---|
129 | * Updates a saved query. (savedQueries.patch)
|
---|
130 | *
|
---|
131 | * @param string $name The resource name of the saved query. The format must be:
|
---|
132 | * * projects/project_number/savedQueries/saved_query_id *
|
---|
133 | * folders/folder_number/savedQueries/saved_query_id *
|
---|
134 | * organizations/organization_number/savedQueries/saved_query_id
|
---|
135 | * @param SavedQuery $postBody
|
---|
136 | * @param array $optParams Optional parameters.
|
---|
137 | *
|
---|
138 | * @opt_param string updateMask Required. The list of fields to update.
|
---|
139 | * @return SavedQuery
|
---|
140 | * @throws \Google\Service\Exception
|
---|
141 | */
|
---|
142 | public function patch($name, SavedQuery $postBody, $optParams = [])
|
---|
143 | {
|
---|
144 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
145 | $params = array_merge($params, $optParams);
|
---|
146 | return $this->call('patch', [$params], SavedQuery::class);
|
---|
147 | }
|
---|
148 | }
|
---|
149 |
|
---|
150 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
151 | class_alias(SavedQueries::class, 'Google_Service_CloudAsset_Resource_SavedQueries');
|
---|