source: vendor/google/apiclient-services/src/Compute/Resource/SecurityPolicies.php

Last change on this file was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 8 weeks ago

Upload project files

  • Property mode set to 100644
File size: 24.6 KB
Line 
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\GlobalSetLabelsRequest;
21use Google\Service\Compute\Operation;
22use Google\Service\Compute\SecurityPoliciesAggregatedList;
23use Google\Service\Compute\SecurityPoliciesListPreconfiguredExpressionSetsResponse;
24use Google\Service\Compute\SecurityPolicy;
25use Google\Service\Compute\SecurityPolicyList;
26use Google\Service\Compute\SecurityPolicyRule;
27
28/**
29 * The "securityPolicies" collection of methods.
30 * Typical usage is:
31 * <code>
32 * $computeService = new Google\Service\Compute(...);
33 * $securityPolicies = $computeService->securityPolicies;
34 * </code>
35 */
36class SecurityPolicies extends \Google\Service\Resource
37{
38 /**
39 * Inserts a rule into a security policy. (securityPolicies.addRule)
40 *
41 * @param string $project Project ID for this request.
42 * @param string $securityPolicy Name of the security policy to update.
43 * @param SecurityPolicyRule $postBody
44 * @param array $optParams Optional parameters.
45 *
46 * @opt_param bool validateOnly If true, the request will not be committed.
47 * @return Operation
48 * @throws \Google\Service\Exception
49 */
50 public function addRule($project, $securityPolicy, SecurityPolicyRule $postBody, $optParams = [])
51 {
52 $params = ['project' => $project, 'securityPolicy' => $securityPolicy, 'postBody' => $postBody];
53 $params = array_merge($params, $optParams);
54 return $this->call('addRule', [$params], Operation::class);
55 }
56 /**
57 * Retrieves the list of all SecurityPolicy resources, regional and global,
58 * available to the specified project. To prevent failure, Google recommends
59 * that you set the `returnPartialSuccess` parameter to `true`.
60 * (securityPolicies.aggregatedList)
61 *
62 * @param string $project Name of the project scoping this request.
63 * @param array $optParams Optional parameters.
64 *
65 * @opt_param string filter A filter expression that filters resources listed in
66 * the response. Most Compute resources support two types of filter expressions:
67 * expressions that support regular expressions and expressions that follow API
68 * improvement proposal AIP-160. These two types of filter expressions cannot be
69 * mixed in one request. If you want to use AIP-160, your expression must
70 * specify the field name, an operator, and the value that you want to use for
71 * filtering. The value must be a string, a number, or a boolean. The operator
72 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
73 * are filtering Compute Engine instances, you can exclude instances named
74 * `example-instance` by specifying `name != example-instance`. The `:*`
75 * comparison can be used to test whether a key has been defined. For example,
76 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
77 * also filter nested fields. For example, you could specify
78 * `scheduling.automaticRestart = false` to include instances only if they are
79 * not scheduled for automatic restarts. You can use filtering on nested fields
80 * to filter based on resource labels. To filter on multiple expressions,
81 * provide each separate expression within parentheses. For example: ```
82 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
83 * default, each expression is an `AND` expression. However, you can include
84 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
85 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
86 * (scheduling.automaticRestart = true) ``` If you want to use a regular
87 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
88 * single un-parenthesized expression with or without quotes or against multiple
89 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
90 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
91 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
92 * interpreted as a regular expression using Google RE2 library syntax. The
93 * literal value must match the entire field. For example, to filter for
94 * instances that do not end with name "instance", you would use `name ne
95 * .*instance`. You cannot combine constraints on multiple fields using regular
96 * expressions.
97 * @opt_param bool includeAllScopes Indicates whether every visible scope for
98 * each scope type (zone, region, global) should be included in the response.
99 * For new resource types added after this field, the flag has no effect as new
100 * resource types will always include every visible scope for each scope type in
101 * response. For resource types which predate this field, if this flag is
102 * omitted or false, only scopes of the scope types where the resource type is
103 * expected to be found will be included.
104 * @opt_param string maxResults The maximum number of results per page that
105 * should be returned. If the number of available results is larger than
106 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
107 * get the next page of results in subsequent list requests. Acceptable values
108 * are `0` to `500`, inclusive. (Default: `500`)
109 * @opt_param string orderBy Sorts list results by a certain order. By default,
110 * results are returned in alphanumerical order based on the resource name. You
111 * can also sort results in descending order based on the creation timestamp
112 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
113 * `creationTimestamp` field in reverse chronological order (newest result
114 * first). Use this to sort resources like operations so that the newest
115 * operation is returned first. Currently, only sorting by `name` or
116 * `creationTimestamp desc` is supported.
117 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
118 * the `nextPageToken` returned by a previous list request to get the next page
119 * of results.
120 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
121 * which provides partial results in case of failure. The default value is
122 * false. For example, when partial success behavior is enabled, aggregatedList
123 * for a single zone scope either returns all resources in the zone or no
124 * resources, with an error code.
125 * @opt_param string serviceProjectNumber The Shared VPC service project id or
126 * service project number for which aggregated list request is invoked for
127 * subnetworks list-usable api.
128 * @return SecurityPoliciesAggregatedList
129 * @throws \Google\Service\Exception
130 */
131 public function aggregatedList($project, $optParams = [])
132 {
133 $params = ['project' => $project];
134 $params = array_merge($params, $optParams);
135 return $this->call('aggregatedList', [$params], SecurityPoliciesAggregatedList::class);
136 }
137 /**
138 * Deletes the specified policy. (securityPolicies.delete)
139 *
140 * @param string $project Project ID for this request.
141 * @param string $securityPolicy Name of the security 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 * @throws \Google\Service\Exception
156 */
157 public function delete($project, $securityPolicy, $optParams = [])
158 {
159 $params = ['project' => $project, 'securityPolicy' => $securityPolicy];
160 $params = array_merge($params, $optParams);
161 return $this->call('delete', [$params], Operation::class);
162 }
163 /**
164 * List all of the ordered rules present in a single specified policy.
165 * (securityPolicies.get)
166 *
167 * @param string $project Project ID for this request.
168 * @param string $securityPolicy Name of the security policy to get.
169 * @param array $optParams Optional parameters.
170 * @return SecurityPolicy
171 * @throws \Google\Service\Exception
172 */
173 public function get($project, $securityPolicy, $optParams = [])
174 {
175 $params = ['project' => $project, 'securityPolicy' => $securityPolicy];
176 $params = array_merge($params, $optParams);
177 return $this->call('get', [$params], SecurityPolicy::class);
178 }
179 /**
180 * Gets a rule at the specified priority. (securityPolicies.getRule)
181 *
182 * @param string $project Project ID for this request.
183 * @param string $securityPolicy Name of the security policy to which the
184 * queried rule belongs.
185 * @param array $optParams Optional parameters.
186 *
187 * @opt_param int priority The priority of the rule to get from the security
188 * policy.
189 * @return SecurityPolicyRule
190 * @throws \Google\Service\Exception
191 */
192 public function getRule($project, $securityPolicy, $optParams = [])
193 {
194 $params = ['project' => $project, 'securityPolicy' => $securityPolicy];
195 $params = array_merge($params, $optParams);
196 return $this->call('getRule', [$params], SecurityPolicyRule::class);
197 }
198 /**
199 * Creates a new policy in the specified project using the data included in the
200 * request. (securityPolicies.insert)
201 *
202 * @param string $project Project ID for this request.
203 * @param SecurityPolicy $postBody
204 * @param array $optParams Optional parameters.
205 *
206 * @opt_param string requestId An optional request ID to identify requests.
207 * Specify a unique request ID so that if you must retry your request, the
208 * server will know to ignore the request if it has already been completed. For
209 * example, consider a situation where you make an initial request and the
210 * request times out. If you make the request again with the same request ID,
211 * the server can check if original operation with the same request ID was
212 * received, and if so, will ignore the second request. This prevents clients
213 * from accidentally creating duplicate commitments. The request ID must be a
214 * valid UUID with the exception that zero UUID is not supported (
215 * 00000000-0000-0000-0000-000000000000).
216 * @opt_param bool validateOnly If true, the request will not be committed.
217 * @return Operation
218 * @throws \Google\Service\Exception
219 */
220 public function insert($project, SecurityPolicy $postBody, $optParams = [])
221 {
222 $params = ['project' => $project, 'postBody' => $postBody];
223 $params = array_merge($params, $optParams);
224 return $this->call('insert', [$params], Operation::class);
225 }
226 /**
227 * List all the policies that have been configured for the specified project.
228 * (securityPolicies.listSecurityPolicies)
229 *
230 * @param string $project Project ID for this request.
231 * @param array $optParams Optional parameters.
232 *
233 * @opt_param string filter A filter expression that filters resources listed in
234 * the response. Most Compute resources support two types of filter expressions:
235 * expressions that support regular expressions and expressions that follow API
236 * improvement proposal AIP-160. These two types of filter expressions cannot be
237 * mixed in one request. If you want to use AIP-160, your expression must
238 * specify the field name, an operator, and the value that you want to use for
239 * filtering. The value must be a string, a number, or a boolean. The operator
240 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
241 * are filtering Compute Engine instances, you can exclude instances named
242 * `example-instance` by specifying `name != example-instance`. The `:*`
243 * comparison can be used to test whether a key has been defined. For example,
244 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
245 * also filter nested fields. For example, you could specify
246 * `scheduling.automaticRestart = false` to include instances only if they are
247 * not scheduled for automatic restarts. You can use filtering on nested fields
248 * to filter based on resource labels. To filter on multiple expressions,
249 * provide each separate expression within parentheses. For example: ```
250 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
251 * default, each expression is an `AND` expression. However, you can include
252 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
253 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
254 * (scheduling.automaticRestart = true) ``` If you want to use a regular
255 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
256 * single un-parenthesized expression with or without quotes or against multiple
257 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
258 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
259 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
260 * interpreted as a regular expression using Google RE2 library syntax. The
261 * literal value must match the entire field. For example, to filter for
262 * instances that do not end with name "instance", you would use `name ne
263 * .*instance`. You cannot combine constraints on multiple fields using regular
264 * expressions.
265 * @opt_param string maxResults The maximum number of results per page that
266 * should be returned. If the number of available results is larger than
267 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
268 * get the next page of results in subsequent list requests. Acceptable values
269 * are `0` to `500`, inclusive. (Default: `500`)
270 * @opt_param string orderBy Sorts list results by a certain order. By default,
271 * results are returned in alphanumerical order based on the resource name. You
272 * can also sort results in descending order based on the creation timestamp
273 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
274 * `creationTimestamp` field in reverse chronological order (newest result
275 * first). Use this to sort resources like operations so that the newest
276 * operation is returned first. Currently, only sorting by `name` or
277 * `creationTimestamp desc` is supported.
278 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
279 * the `nextPageToken` returned by a previous list request to get the next page
280 * of results.
281 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
282 * which provides partial results in case of failure. The default value is
283 * false. For example, when partial success behavior is enabled, aggregatedList
284 * for a single zone scope either returns all resources in the zone or no
285 * resources, with an error code.
286 * @return SecurityPolicyList
287 * @throws \Google\Service\Exception
288 */
289 public function listSecurityPolicies($project, $optParams = [])
290 {
291 $params = ['project' => $project];
292 $params = array_merge($params, $optParams);
293 return $this->call('list', [$params], SecurityPolicyList::class);
294 }
295 /**
296 * Gets the current list of preconfigured Web Application Firewall (WAF)
297 * expressions. (securityPolicies.listPreconfiguredExpressionSets)
298 *
299 * @param string $project Project ID for this request.
300 * @param array $optParams Optional parameters.
301 *
302 * @opt_param string filter A filter expression that filters resources listed in
303 * the response. Most Compute resources support two types of filter expressions:
304 * expressions that support regular expressions and expressions that follow API
305 * improvement proposal AIP-160. These two types of filter expressions cannot be
306 * mixed in one request. If you want to use AIP-160, your expression must
307 * specify the field name, an operator, and the value that you want to use for
308 * filtering. The value must be a string, a number, or a boolean. The operator
309 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
310 * are filtering Compute Engine instances, you can exclude instances named
311 * `example-instance` by specifying `name != example-instance`. The `:*`
312 * comparison can be used to test whether a key has been defined. For example,
313 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
314 * also filter nested fields. For example, you could specify
315 * `scheduling.automaticRestart = false` to include instances only if they are
316 * not scheduled for automatic restarts. You can use filtering on nested fields
317 * to filter based on resource labels. To filter on multiple expressions,
318 * provide each separate expression within parentheses. For example: ```
319 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
320 * default, each expression is an `AND` expression. However, you can include
321 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
322 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
323 * (scheduling.automaticRestart = true) ``` If you want to use a regular
324 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
325 * single un-parenthesized expression with or without quotes or against multiple
326 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
327 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
328 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
329 * interpreted as a regular expression using Google RE2 library syntax. The
330 * literal value must match the entire field. For example, to filter for
331 * instances that do not end with name "instance", you would use `name ne
332 * .*instance`. You cannot combine constraints on multiple fields using regular
333 * expressions.
334 * @opt_param string maxResults The maximum number of results per page that
335 * should be returned. If the number of available results is larger than
336 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
337 * get the next page of results in subsequent list requests. Acceptable values
338 * are `0` to `500`, inclusive. (Default: `500`)
339 * @opt_param string orderBy Sorts list results by a certain order. By default,
340 * results are returned in alphanumerical order based on the resource name. You
341 * can also sort results in descending order based on the creation timestamp
342 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
343 * `creationTimestamp` field in reverse chronological order (newest result
344 * first). Use this to sort resources like operations so that the newest
345 * operation is returned first. Currently, only sorting by `name` or
346 * `creationTimestamp desc` is supported.
347 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
348 * the `nextPageToken` returned by a previous list request to get the next page
349 * of results.
350 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
351 * which provides partial results in case of failure. The default value is
352 * false. For example, when partial success behavior is enabled, aggregatedList
353 * for a single zone scope either returns all resources in the zone or no
354 * resources, with an error code.
355 * @return SecurityPoliciesListPreconfiguredExpressionSetsResponse
356 * @throws \Google\Service\Exception
357 */
358 public function listPreconfiguredExpressionSets($project, $optParams = [])
359 {
360 $params = ['project' => $project];
361 $params = array_merge($params, $optParams);
362 return $this->call('listPreconfiguredExpressionSets', [$params], SecurityPoliciesListPreconfiguredExpressionSetsResponse::class);
363 }
364 /**
365 * Patches the specified policy with the data included in the request. To clear
366 * fields in the policy, leave the fields empty and specify them in the
367 * updateMask. This cannot be used to be update the rules in the policy. Please
368 * use the per rule methods like addRule, patchRule, and removeRule instead.
369 * (securityPolicies.patch)
370 *
371 * @param string $project Project ID for this request.
372 * @param string $securityPolicy Name of the security policy to update.
373 * @param SecurityPolicy $postBody
374 * @param array $optParams Optional parameters.
375 *
376 * @opt_param string requestId An optional request ID to identify requests.
377 * Specify a unique request ID so that if you must retry your request, the
378 * server will know to ignore the request if it has already been completed. For
379 * example, consider a situation where you make an initial request and the
380 * request times out. If you make the request again with the same request ID,
381 * the server can check if original operation with the same request ID was
382 * received, and if so, will ignore the second request. This prevents clients
383 * from accidentally creating duplicate commitments. The request ID must be a
384 * valid UUID with the exception that zero UUID is not supported (
385 * 00000000-0000-0000-0000-000000000000).
386 * @opt_param string updateMask Indicates fields to be cleared as part of this
387 * request.
388 * @return Operation
389 * @throws \Google\Service\Exception
390 */
391 public function patch($project, $securityPolicy, SecurityPolicy $postBody, $optParams = [])
392 {
393 $params = ['project' => $project, 'securityPolicy' => $securityPolicy, 'postBody' => $postBody];
394 $params = array_merge($params, $optParams);
395 return $this->call('patch', [$params], Operation::class);
396 }
397 /**
398 * Patches a rule at the specified priority. To clear fields in the rule, leave
399 * the fields empty and specify them in the updateMask.
400 * (securityPolicies.patchRule)
401 *
402 * @param string $project Project ID for this request.
403 * @param string $securityPolicy Name of the security policy to update.
404 * @param SecurityPolicyRule $postBody
405 * @param array $optParams Optional parameters.
406 *
407 * @opt_param int priority The priority of the rule to patch.
408 * @opt_param string updateMask Indicates fields to be cleared as part of this
409 * request.
410 * @opt_param bool validateOnly If true, the request will not be committed.
411 * @return Operation
412 * @throws \Google\Service\Exception
413 */
414 public function patchRule($project, $securityPolicy, SecurityPolicyRule $postBody, $optParams = [])
415 {
416 $params = ['project' => $project, 'securityPolicy' => $securityPolicy, 'postBody' => $postBody];
417 $params = array_merge($params, $optParams);
418 return $this->call('patchRule', [$params], Operation::class);
419 }
420 /**
421 * Deletes a rule at the specified priority. (securityPolicies.removeRule)
422 *
423 * @param string $project Project ID for this request.
424 * @param string $securityPolicy Name of the security policy to update.
425 * @param array $optParams Optional parameters.
426 *
427 * @opt_param int priority The priority of the rule to remove from the security
428 * policy.
429 * @return Operation
430 * @throws \Google\Service\Exception
431 */
432 public function removeRule($project, $securityPolicy, $optParams = [])
433 {
434 $params = ['project' => $project, 'securityPolicy' => $securityPolicy];
435 $params = array_merge($params, $optParams);
436 return $this->call('removeRule', [$params], Operation::class);
437 }
438 /**
439 * Sets the labels on a security policy. To learn more about labels, read the
440 * Labeling Resources documentation. (securityPolicies.setLabels)
441 *
442 * @param string $project Project ID for this request.
443 * @param string $resource Name or id of the resource for this request.
444 * @param GlobalSetLabelsRequest $postBody
445 * @param array $optParams Optional parameters.
446 * @return Operation
447 * @throws \Google\Service\Exception
448 */
449 public function setLabels($project, $resource, GlobalSetLabelsRequest $postBody, $optParams = [])
450 {
451 $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
452 $params = array_merge($params, $optParams);
453 return $this->call('setLabels', [$params], Operation::class);
454 }
455}
456
457// Adding a class alias for backwards compatibility with the previous class name.
458class_alias(SecurityPolicies::class, 'Google_Service_Compute_Resource_SecurityPolicies');
Note: See TracBrowser for help on using the repository browser.