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/** 19 * The "securityPolicies" collection of methods. 20 * Typical usage is: 21 * <code> 22 * $computeService = new Google_Service_Compute(...); 23 * $securityPolicies = $computeService->securityPolicies; 24 * </code> 25 */ 26class Google_Service_Compute_Resource_SecurityPolicies extends Google_Service_Resource 27{ 28 /** 29 * Inserts a rule into a security policy. (securityPolicies.addRule) 30 * 31 * @param string $project Project ID for this request. 32 * @param string $securityPolicy Name of the security policy to update. 33 * @param Google_Service_Compute_SecurityPolicyRule $postBody 34 * @param array $optParams Optional parameters. 35 * @return Google_Service_Compute_Operation 36 */ 37 public function addRule($project, $securityPolicy, Google_Service_Compute_SecurityPolicyRule $postBody, $optParams = array()) 38 { 39 $params = array('project' => $project, 'securityPolicy' => $securityPolicy, 'postBody' => $postBody); 40 $params = array_merge($params, $optParams); 41 return $this->call('addRule', array($params), "Google_Service_Compute_Operation"); 42 } 43 /** 44 * Deletes the specified policy. (securityPolicies.delete) 45 * 46 * @param string $project Project ID for this request. 47 * @param string $securityPolicy Name of the security policy to delete. 48 * @param array $optParams Optional parameters. 49 * 50 * @opt_param string requestId An optional request ID to identify requests. 51 * Specify a unique request ID so that if you must retry your request, the 52 * server will know to ignore the request if it has already been completed. 53 * 54 * For example, consider a situation where you make an initial request and the 55 * request times out. If you make the request again with the same request ID, 56 * the server can check if original operation with the same request ID was 57 * received, and if so, will ignore the second request. This prevents clients 58 * from accidentally creating duplicate commitments. 59 * 60 * The request ID must be a valid UUID with the exception that zero UUID is not 61 * supported (00000000-0000-0000-0000-000000000000). 62 * @return Google_Service_Compute_Operation 63 */ 64 public function delete($project, $securityPolicy, $optParams = array()) 65 { 66 $params = array('project' => $project, 'securityPolicy' => $securityPolicy); 67 $params = array_merge($params, $optParams); 68 return $this->call('delete', array($params), "Google_Service_Compute_Operation"); 69 } 70 /** 71 * List all of the ordered rules present in a single specified policy. 72 * (securityPolicies.get) 73 * 74 * @param string $project Project ID for this request. 75 * @param string $securityPolicy Name of the security policy to get. 76 * @param array $optParams Optional parameters. 77 * @return Google_Service_Compute_SecurityPolicy 78 */ 79 public function get($project, $securityPolicy, $optParams = array()) 80 { 81 $params = array('project' => $project, 'securityPolicy' => $securityPolicy); 82 $params = array_merge($params, $optParams); 83 return $this->call('get', array($params), "Google_Service_Compute_SecurityPolicy"); 84 } 85 /** 86 * Gets a rule at the specified priority. (securityPolicies.getRule) 87 * 88 * @param string $project Project ID for this request. 89 * @param string $securityPolicy Name of the security policy to which the 90 * queried rule belongs. 91 * @param array $optParams Optional parameters. 92 * 93 * @opt_param int priority The priority of the rule to get from the security 94 * policy. 95 * @return Google_Service_Compute_SecurityPolicyRule 96 */ 97 public function getRule($project, $securityPolicy, $optParams = array()) 98 { 99 $params = array('project' => $project, 'securityPolicy' => $securityPolicy); 100 $params = array_merge($params, $optParams); 101 return $this->call('getRule', array($params), "Google_Service_Compute_SecurityPolicyRule"); 102 } 103 /** 104 * Creates a new policy in the specified project using the data included in the 105 * request. (securityPolicies.insert) 106 * 107 * @param string $project Project ID for this request. 108 * @param Google_Service_Compute_SecurityPolicy $postBody 109 * @param array $optParams Optional parameters. 110 * 111 * @opt_param string requestId An optional request ID to identify requests. 112 * Specify a unique request ID so that if you must retry your request, the 113 * server will know to ignore the request if it has already been completed. 114 * 115 * For example, consider a situation where you make an initial request and the 116 * request times out. If you make the request again with the same request ID, 117 * the server can check if original operation with the same request ID was 118 * received, and if so, will ignore the second request. This prevents clients 119 * from accidentally creating duplicate commitments. 120 * 121 * The request ID must be a valid UUID with the exception that zero UUID is not 122 * supported (00000000-0000-0000-0000-000000000000). 123 * @return Google_Service_Compute_Operation 124 */ 125 public function insert($project, Google_Service_Compute_SecurityPolicy $postBody, $optParams = array()) 126 { 127 $params = array('project' => $project, 'postBody' => $postBody); 128 $params = array_merge($params, $optParams); 129 return $this->call('insert', array($params), "Google_Service_Compute_Operation"); 130 } 131 /** 132 * List all the policies that have been configured for the specified project. 133 * (securityPolicies.listSecurityPolicies) 134 * 135 * @param string $project Project ID for this request. 136 * @param array $optParams Optional parameters. 137 * 138 * @opt_param string filter A filter expression that filters resources listed in 139 * the response. The expression must specify the field name, a comparison 140 * operator, and the value that you want to use for filtering. The value must be 141 * a string, a number, or a boolean. The comparison operator must be either =, 142 * !=, >, or <. 143 * 144 * For example, if you are filtering Compute Engine instances, you can exclude 145 * instances named example-instance by specifying name != example-instance. 146 * 147 * You can also filter nested fields. For example, you could specify 148 * scheduling.automaticRestart = false to include instances only if they are not 149 * scheduled for automatic restarts. You can use filtering on nested fields to 150 * filter based on resource labels. 151 * 152 * To filter on multiple expressions, provide each separate expression within 153 * parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = 154 * "Intel Skylake"). By default, each expression is an AND expression. However, 155 * you can include AND and OR expressions explicitly. For example, (cpuPlatform 156 * = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND 157 * (scheduling.automaticRestart = true). 158 * @opt_param string maxResults The maximum number of results per page that 159 * should be returned. If the number of available results is larger than 160 * maxResults, Compute Engine returns a nextPageToken that can be used to get 161 * the next page of results in subsequent list requests. Acceptable values are 0 162 * to 500, inclusive. (Default: 500) 163 * @opt_param string orderBy Sorts list results by a certain order. By default, 164 * results are returned in alphanumerical order based on the resource name. 165 * 166 * You can also sort results in descending order based on the creation timestamp 167 * using orderBy="creationTimestamp desc". This sorts results based on the 168 * creationTimestamp field in reverse chronological order (newest result first). 169 * Use this to sort resources like operations so that the newest operation is 170 * returned first. 171 * 172 * Currently, only sorting by name or creationTimestamp desc is supported. 173 * @opt_param string pageToken Specifies a page token to use. Set pageToken to 174 * the nextPageToken returned by a previous list request to get the next page of 175 * results. 176 * @return Google_Service_Compute_SecurityPolicyList 177 */ 178 public function listSecurityPolicies($project, $optParams = array()) 179 { 180 $params = array('project' => $project); 181 $params = array_merge($params, $optParams); 182 return $this->call('list', array($params), "Google_Service_Compute_SecurityPolicyList"); 183 } 184 /** 185 * Patches the specified policy with the data included in the request. 186 * (securityPolicies.patch) 187 * 188 * @param string $project Project ID for this request. 189 * @param string $securityPolicy Name of the security policy to update. 190 * @param Google_Service_Compute_SecurityPolicy $postBody 191 * @param array $optParams Optional parameters. 192 * 193 * @opt_param string requestId An optional request ID to identify requests. 194 * Specify a unique request ID so that if you must retry your request, the 195 * server will know to ignore the request if it has already been completed. 196 * 197 * For example, consider a situation where you make an initial request and the 198 * request times out. If you make the request again with the same request ID, 199 * the server can check if original operation with the same request ID was 200 * received, and if so, will ignore the second request. This prevents clients 201 * from accidentally creating duplicate commitments. 202 * 203 * The request ID must be a valid UUID with the exception that zero UUID is not 204 * supported (00000000-0000-0000-0000-000000000000). 205 * @return Google_Service_Compute_Operation 206 */ 207 public function patch($project, $securityPolicy, Google_Service_Compute_SecurityPolicy $postBody, $optParams = array()) 208 { 209 $params = array('project' => $project, 'securityPolicy' => $securityPolicy, 'postBody' => $postBody); 210 $params = array_merge($params, $optParams); 211 return $this->call('patch', array($params), "Google_Service_Compute_Operation"); 212 } 213 /** 214 * Patches a rule at the specified priority. (securityPolicies.patchRule) 215 * 216 * @param string $project Project ID for this request. 217 * @param string $securityPolicy Name of the security policy to update. 218 * @param Google_Service_Compute_SecurityPolicyRule $postBody 219 * @param array $optParams Optional parameters. 220 * 221 * @opt_param int priority The priority of the rule to patch. 222 * @return Google_Service_Compute_Operation 223 */ 224 public function patchRule($project, $securityPolicy, Google_Service_Compute_SecurityPolicyRule $postBody, $optParams = array()) 225 { 226 $params = array('project' => $project, 'securityPolicy' => $securityPolicy, 'postBody' => $postBody); 227 $params = array_merge($params, $optParams); 228 return $this->call('patchRule', array($params), "Google_Service_Compute_Operation"); 229 } 230 /** 231 * Deletes a rule at the specified priority. (securityPolicies.removeRule) 232 * 233 * @param string $project Project ID for this request. 234 * @param string $securityPolicy Name of the security policy to update. 235 * @param array $optParams Optional parameters. 236 * 237 * @opt_param int priority The priority of the rule to remove from the security 238 * policy. 239 * @return Google_Service_Compute_Operation 240 */ 241 public function removeRule($project, $securityPolicy, $optParams = array()) 242 { 243 $params = array('project' => $project, 'securityPolicy' => $securityPolicy); 244 $params = array_merge($params, $optParams); 245 return $this->call('removeRule', array($params), "Google_Service_Compute_Operation"); 246 } 247} 248