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