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\Compute\Resource; 19 20use Google\Service\Compute\FirewallPolicy; 21use Google\Service\Compute\FirewallPolicyAssociation; 22use Google\Service\Compute\FirewallPolicyList; 23use Google\Service\Compute\FirewallPolicyRule; 24use Google\Service\Compute\Operation; 25use Google\Service\Compute\Policy; 26use Google\Service\Compute\RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse; 27use Google\Service\Compute\RegionSetPolicyRequest; 28use Google\Service\Compute\TestPermissionsRequest; 29use Google\Service\Compute\TestPermissionsResponse; 30 31/** 32 * The "regionNetworkFirewallPolicies" collection of methods. 33 * Typical usage is: 34 * <code> 35 * $computeService = new Google\Service\Compute(...); 36 * $regionNetworkFirewallPolicies = $computeService->regionNetworkFirewallPolicies; 37 * </code> 38 */ 39class RegionNetworkFirewallPolicies extends \Google\Service\Resource 40{ 41 /** 42 * Inserts an association for the specified network firewall policy. 43 * (regionNetworkFirewallPolicies.addAssociation) 44 * 45 * @param string $project Project ID for this request. 46 * @param string $region Name of the region scoping this request. 47 * @param string $firewallPolicy Name of the firewall policy to update. 48 * @param FirewallPolicyAssociation $postBody 49 * @param array $optParams Optional parameters. 50 * 51 * @opt_param bool replaceExistingAssociation Indicates whether or not to 52 * replace it if an association already exists. This is false by default, in 53 * which case an error will be returned if an association already exists. 54 * @opt_param string requestId An optional request ID to identify requests. 55 * Specify a unique request ID so that if you must retry your request, the 56 * server will know to ignore the request if it has already been completed. For 57 * example, consider a situation where you make an initial request and the 58 * request times out. If you make the request again with the same request ID, 59 * the server can check if original operation with the same request ID was 60 * received, and if so, will ignore the second request. This prevents clients 61 * from accidentally creating duplicate commitments. The request ID must be a 62 * valid UUID with the exception that zero UUID is not supported ( 63 * 00000000-0000-0000-0000-000000000000). 64 * @return Operation 65 */ 66 public function addAssociation($project, $region, $firewallPolicy, FirewallPolicyAssociation $postBody, $optParams = []) 67 { 68 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy, 'postBody' => $postBody]; 69 $params = array_merge($params, $optParams); 70 return $this->call('addAssociation', [$params], Operation::class); 71 } 72 /** 73 * Inserts a rule into a network firewall policy. 74 * (regionNetworkFirewallPolicies.addRule) 75 * 76 * @param string $project Project ID for this request. 77 * @param string $region Name of the region scoping this request. 78 * @param string $firewallPolicy Name of the firewall policy to update. 79 * @param FirewallPolicyRule $postBody 80 * @param array $optParams Optional parameters. 81 * 82 * @opt_param int maxPriority When rule.priority is not specified, auto choose a 83 * unused priority between minPriority and maxPriority>. This field is exclusive 84 * with rule.priority. 85 * @opt_param int minPriority When rule.priority is not specified, auto choose a 86 * unused priority between minPriority and maxPriority>. This field is exclusive 87 * with rule.priority. 88 * @opt_param string requestId An optional request ID to identify requests. 89 * Specify a unique request ID so that if you must retry your request, the 90 * server will know to ignore the request if it has already been completed. For 91 * example, consider a situation where you make an initial request and the 92 * request times out. If you make the request again with the same request ID, 93 * the server can check if original operation with the same request ID was 94 * received, and if so, will ignore the second request. This prevents clients 95 * from accidentally creating duplicate commitments. The request ID must be a 96 * valid UUID with the exception that zero UUID is not supported ( 97 * 00000000-0000-0000-0000-000000000000). 98 * @return Operation 99 */ 100 public function addRule($project, $region, $firewallPolicy, FirewallPolicyRule $postBody, $optParams = []) 101 { 102 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy, 'postBody' => $postBody]; 103 $params = array_merge($params, $optParams); 104 return $this->call('addRule', [$params], Operation::class); 105 } 106 /** 107 * Copies rules to the specified network firewall policy. 108 * (regionNetworkFirewallPolicies.cloneRules) 109 * 110 * @param string $project Project ID for this request. 111 * @param string $region Name of the region scoping this request. 112 * @param string $firewallPolicy Name of the firewall policy to update. 113 * @param array $optParams Optional parameters. 114 * 115 * @opt_param string requestId An optional request ID to identify requests. 116 * Specify a unique request ID so that if you must retry your request, the 117 * server will know to ignore the request if it has already been completed. For 118 * example, consider a situation where you make an initial request and the 119 * request times out. If you make the request again with the same request ID, 120 * the server can check if original operation with the same request ID was 121 * received, and if so, will ignore the second request. This prevents clients 122 * from accidentally creating duplicate commitments. The request ID must be a 123 * valid UUID with the exception that zero UUID is not supported ( 124 * 00000000-0000-0000-0000-000000000000). 125 * @opt_param string sourceFirewallPolicy The firewall policy from which to copy 126 * rules. 127 * @return Operation 128 */ 129 public function cloneRules($project, $region, $firewallPolicy, $optParams = []) 130 { 131 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy]; 132 $params = array_merge($params, $optParams); 133 return $this->call('cloneRules', [$params], Operation::class); 134 } 135 /** 136 * Deletes the specified network firewall policy. 137 * (regionNetworkFirewallPolicies.delete) 138 * 139 * @param string $project Project ID for this request. 140 * @param string $region Name of the region scoping this request. 141 * @param string $firewallPolicy Name of the firewall policy to delete. 142 * @param array $optParams Optional parameters. 143 * 144 * @opt_param string requestId An optional request ID to identify requests. 145 * Specify a unique request ID so that if you must retry your request, the 146 * server will know to ignore the request if it has already been completed. For 147 * example, consider a situation where you make an initial request and the 148 * request times out. If you make the request again with the same request ID, 149 * the server can check if original operation with the same request ID was 150 * received, and if so, will ignore the second request. This prevents clients 151 * from accidentally creating duplicate commitments. The request ID must be a 152 * valid UUID with the exception that zero UUID is not supported ( 153 * 00000000-0000-0000-0000-000000000000). 154 * @return Operation 155 */ 156 public function delete($project, $region, $firewallPolicy, $optParams = []) 157 { 158 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy]; 159 $params = array_merge($params, $optParams); 160 return $this->call('delete', [$params], Operation::class); 161 } 162 /** 163 * Returns the specified network firewall policy. 164 * (regionNetworkFirewallPolicies.get) 165 * 166 * @param string $project Project ID for this request. 167 * @param string $region Name of the region scoping this request. 168 * @param string $firewallPolicy Name of the firewall policy to get. 169 * @param array $optParams Optional parameters. 170 * @return FirewallPolicy 171 */ 172 public function get($project, $region, $firewallPolicy, $optParams = []) 173 { 174 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy]; 175 $params = array_merge($params, $optParams); 176 return $this->call('get', [$params], FirewallPolicy::class); 177 } 178 /** 179 * Gets an association with the specified name. 180 * (regionNetworkFirewallPolicies.getAssociation) 181 * 182 * @param string $project Project ID for this request. 183 * @param string $region Name of the region scoping this request. 184 * @param string $firewallPolicy Name of the firewall policy to which the 185 * queried association belongs. 186 * @param array $optParams Optional parameters. 187 * 188 * @opt_param string name The name of the association to get from the firewall 189 * policy. 190 * @return FirewallPolicyAssociation 191 */ 192 public function getAssociation($project, $region, $firewallPolicy, $optParams = []) 193 { 194 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy]; 195 $params = array_merge($params, $optParams); 196 return $this->call('getAssociation', [$params], FirewallPolicyAssociation::class); 197 } 198 /** 199 * Returns the effective firewalls on a given network. 200 * (regionNetworkFirewallPolicies.getEffectiveFirewalls) 201 * 202 * @param string $project Project ID for this request. 203 * @param string $region Name of the region scoping this request. 204 * @param string $network Network reference 205 * @param array $optParams Optional parameters. 206 * @return RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse 207 */ 208 public function getEffectiveFirewalls($project, $region, $network, $optParams = []) 209 { 210 $params = ['project' => $project, 'region' => $region, 'network' => $network]; 211 $params = array_merge($params, $optParams); 212 return $this->call('getEffectiveFirewalls', [$params], RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse::class); 213 } 214 /** 215 * Gets the access control policy for a resource. May be empty if no such policy 216 * or resource exists. (regionNetworkFirewallPolicies.getIamPolicy) 217 * 218 * @param string $project Project ID for this request. 219 * @param string $region The name of the region for this request. 220 * @param string $resource Name or id of the resource for this request. 221 * @param array $optParams Optional parameters. 222 * 223 * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version. 224 * @return Policy 225 */ 226 public function getIamPolicy($project, $region, $resource, $optParams = []) 227 { 228 $params = ['project' => $project, 'region' => $region, 'resource' => $resource]; 229 $params = array_merge($params, $optParams); 230 return $this->call('getIamPolicy', [$params], Policy::class); 231 } 232 /** 233 * Gets a rule of the specified priority. 234 * (regionNetworkFirewallPolicies.getRule) 235 * 236 * @param string $project Project ID for this request. 237 * @param string $region Name of the region scoping this request. 238 * @param string $firewallPolicy Name of the firewall policy to which the 239 * queried rule belongs. 240 * @param array $optParams Optional parameters. 241 * 242 * @opt_param int priority The priority of the rule to get from the firewall 243 * policy. 244 * @return FirewallPolicyRule 245 */ 246 public function getRule($project, $region, $firewallPolicy, $optParams = []) 247 { 248 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy]; 249 $params = array_merge($params, $optParams); 250 return $this->call('getRule', [$params], FirewallPolicyRule::class); 251 } 252 /** 253 * Creates a new network firewall policy in the specified project and region. 254 * (regionNetworkFirewallPolicies.insert) 255 * 256 * @param string $project Project ID for this request. 257 * @param string $region Name of the region scoping this request. 258 * @param FirewallPolicy $postBody 259 * @param array $optParams Optional parameters. 260 * 261 * @opt_param string requestId An optional request ID to identify requests. 262 * Specify a unique request ID so that if you must retry your request, the 263 * server will know to ignore the request if it has already been completed. For 264 * example, consider a situation where you make an initial request and the 265 * request times out. If you make the request again with the same request ID, 266 * the server can check if original operation with the same request ID was 267 * received, and if so, will ignore the second request. This prevents clients 268 * from accidentally creating duplicate commitments. The request ID must be a 269 * valid UUID with the exception that zero UUID is not supported ( 270 * 00000000-0000-0000-0000-000000000000). 271 * @return Operation 272 */ 273 public function insert($project, $region, FirewallPolicy $postBody, $optParams = []) 274 { 275 $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody]; 276 $params = array_merge($params, $optParams); 277 return $this->call('insert', [$params], Operation::class); 278 } 279 /** 280 * Lists all the network firewall policies that have been configured for the 281 * specified project in the given region. 282 * (regionNetworkFirewallPolicies.listRegionNetworkFirewallPolicies) 283 * 284 * @param string $project Project ID for this request. 285 * @param string $region Name of the region scoping this request. 286 * @param array $optParams Optional parameters. 287 * 288 * @opt_param string filter A filter expression that filters resources listed in 289 * the response. The expression must specify the field name, an operator, and 290 * the value that you want to use for filtering. The value must be a string, a 291 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 292 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 293 * can exclude instances named `example-instance` by specifying `name != 294 * example-instance`. The `:` operator can be used with string fields to match 295 * substrings. For non-string fields it is equivalent to the `=` operator. The 296 * `:*` comparison can be used to test whether a key has been defined. For 297 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 298 * You can also filter nested fields. For example, you could specify 299 * `scheduling.automaticRestart = false` to include instances only if they are 300 * not scheduled for automatic restarts. You can use filtering on nested fields 301 * to filter based on resource labels. To filter on multiple expressions, 302 * provide each separate expression within parentheses. For example: ``` 303 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 304 * default, each expression is an `AND` expression. However, you can include 305 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 306 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 307 * (scheduling.automaticRestart = true) ``` 308 * @opt_param string maxResults The maximum number of results per page that 309 * should be returned. If the number of available results is larger than 310 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 311 * get the next page of results in subsequent list requests. Acceptable values 312 * are `0` to `500`, inclusive. (Default: `500`) 313 * @opt_param string orderBy Sorts list results by a certain order. By default, 314 * results are returned in alphanumerical order based on the resource name. You 315 * can also sort results in descending order based on the creation timestamp 316 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 317 * `creationTimestamp` field in reverse chronological order (newest result 318 * first). Use this to sort resources like operations so that the newest 319 * operation is returned first. Currently, only sorting by `name` or 320 * `creationTimestamp desc` is supported. 321 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 322 * the `nextPageToken` returned by a previous list request to get the next page 323 * of results. 324 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 325 * which provides partial results in case of failure. The default value is 326 * false. 327 * @return FirewallPolicyList 328 */ 329 public function listRegionNetworkFirewallPolicies($project, $region, $optParams = []) 330 { 331 $params = ['project' => $project, 'region' => $region]; 332 $params = array_merge($params, $optParams); 333 return $this->call('list', [$params], FirewallPolicyList::class); 334 } 335 /** 336 * Patches the specified network firewall policy. 337 * (regionNetworkFirewallPolicies.patch) 338 * 339 * @param string $project Project ID for this request. 340 * @param string $region Name of the region scoping this request. 341 * @param string $firewallPolicy Name of the firewall policy to update. 342 * @param FirewallPolicy $postBody 343 * @param array $optParams Optional parameters. 344 * 345 * @opt_param string requestId An optional request ID to identify requests. 346 * Specify a unique request ID so that if you must retry your request, the 347 * server will know to ignore the request if it has already been completed. For 348 * example, consider a situation where you make an initial request and the 349 * request times out. If you make the request again with the same request ID, 350 * the server can check if original operation with the same request ID was 351 * received, and if so, will ignore the second request. This prevents clients 352 * from accidentally creating duplicate commitments. The request ID must be a 353 * valid UUID with the exception that zero UUID is not supported ( 354 * 00000000-0000-0000-0000-000000000000). 355 * @return Operation 356 */ 357 public function patch($project, $region, $firewallPolicy, FirewallPolicy $postBody, $optParams = []) 358 { 359 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy, 'postBody' => $postBody]; 360 $params = array_merge($params, $optParams); 361 return $this->call('patch', [$params], Operation::class); 362 } 363 /** 364 * Patches a rule of the specified priority. 365 * (regionNetworkFirewallPolicies.patchRule) 366 * 367 * @param string $project Project ID for this request. 368 * @param string $region Name of the region scoping this request. 369 * @param string $firewallPolicy Name of the firewall policy to update. 370 * @param FirewallPolicyRule $postBody 371 * @param array $optParams Optional parameters. 372 * 373 * @opt_param int priority The priority of the rule to patch. 374 * @opt_param string requestId An optional request ID to identify requests. 375 * Specify a unique request ID so that if you must retry your request, the 376 * server will know to ignore the request if it has already been completed. For 377 * example, consider a situation where you make an initial request and the 378 * request times out. If you make the request again with the same request ID, 379 * the server can check if original operation with the same request ID was 380 * received, and if so, will ignore the second request. This prevents clients 381 * from accidentally creating duplicate commitments. The request ID must be a 382 * valid UUID with the exception that zero UUID is not supported ( 383 * 00000000-0000-0000-0000-000000000000). 384 * @return Operation 385 */ 386 public function patchRule($project, $region, $firewallPolicy, FirewallPolicyRule $postBody, $optParams = []) 387 { 388 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy, 'postBody' => $postBody]; 389 $params = array_merge($params, $optParams); 390 return $this->call('patchRule', [$params], Operation::class); 391 } 392 /** 393 * Removes an association for the specified network firewall policy. 394 * (regionNetworkFirewallPolicies.removeAssociation) 395 * 396 * @param string $project Project ID for this request. 397 * @param string $region Name of the region scoping this request. 398 * @param string $firewallPolicy Name of the firewall policy to update. 399 * @param array $optParams Optional parameters. 400 * 401 * @opt_param string name Name for the association that will be removed. 402 * @opt_param string requestId An optional request ID to identify requests. 403 * Specify a unique request ID so that if you must retry your request, the 404 * server will know to ignore the request if it has already been completed. For 405 * example, consider a situation where you make an initial request and the 406 * request times out. If you make the request again with the same request ID, 407 * the server can check if original operation with the same request ID was 408 * received, and if so, will ignore the second request. This prevents clients 409 * from accidentally creating duplicate commitments. The request ID must be a 410 * valid UUID with the exception that zero UUID is not supported ( 411 * 00000000-0000-0000-0000-000000000000). 412 * @return Operation 413 */ 414 public function removeAssociation($project, $region, $firewallPolicy, $optParams = []) 415 { 416 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy]; 417 $params = array_merge($params, $optParams); 418 return $this->call('removeAssociation', [$params], Operation::class); 419 } 420 /** 421 * Deletes a rule of the specified priority. 422 * (regionNetworkFirewallPolicies.removeRule) 423 * 424 * @param string $project Project ID for this request. 425 * @param string $region Name of the region scoping this request. 426 * @param string $firewallPolicy Name of the firewall policy to update. 427 * @param array $optParams Optional parameters. 428 * 429 * @opt_param int priority The priority of the rule to remove from the firewall 430 * policy. 431 * @opt_param string requestId An optional request ID to identify requests. 432 * Specify a unique request ID so that if you must retry your request, the 433 * server will know to ignore the request if it has already been completed. For 434 * example, consider a situation where you make an initial request and the 435 * request times out. If you make the request again with the same request ID, 436 * the server can check if original operation with the same request ID was 437 * received, and if so, will ignore the second request. This prevents clients 438 * from accidentally creating duplicate commitments. The request ID must be a 439 * valid UUID with the exception that zero UUID is not supported ( 440 * 00000000-0000-0000-0000-000000000000). 441 * @return Operation 442 */ 443 public function removeRule($project, $region, $firewallPolicy, $optParams = []) 444 { 445 $params = ['project' => $project, 'region' => $region, 'firewallPolicy' => $firewallPolicy]; 446 $params = array_merge($params, $optParams); 447 return $this->call('removeRule', [$params], Operation::class); 448 } 449 /** 450 * Sets the access control policy on the specified resource. Replaces any 451 * existing policy. (regionNetworkFirewallPolicies.setIamPolicy) 452 * 453 * @param string $project Project ID for this request. 454 * @param string $region The name of the region for this request. 455 * @param string $resource Name or id of the resource for this request. 456 * @param RegionSetPolicyRequest $postBody 457 * @param array $optParams Optional parameters. 458 * @return Policy 459 */ 460 public function setIamPolicy($project, $region, $resource, RegionSetPolicyRequest $postBody, $optParams = []) 461 { 462 $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody]; 463 $params = array_merge($params, $optParams); 464 return $this->call('setIamPolicy', [$params], Policy::class); 465 } 466 /** 467 * Returns permissions that a caller has on the specified resource. 468 * (regionNetworkFirewallPolicies.testIamPermissions) 469 * 470 * @param string $project Project ID for this request. 471 * @param string $region The name of the region for this request. 472 * @param string $resource Name or id of the resource for this request. 473 * @param TestPermissionsRequest $postBody 474 * @param array $optParams Optional parameters. 475 * @return TestPermissionsResponse 476 */ 477 public function testIamPermissions($project, $region, $resource, TestPermissionsRequest $postBody, $optParams = []) 478 { 479 $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody]; 480 $params = array_merge($params, $optParams); 481 return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class); 482 } 483} 484 485// Adding a class alias for backwards compatibility with the previous class name. 486class_alias(RegionNetworkFirewallPolicies::class, 'Google_Service_Compute_Resource_RegionNetworkFirewallPolicies'); 487