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

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

Upload project files

  • Property mode set to 100644
File size: 18.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\Operation;
21use Google\Service\Compute\Policy;
22use Google\Service\Compute\RegionSetPolicyRequest;
23use Google\Service\Compute\ResourcePolicy;
24use Google\Service\Compute\ResourcePolicyAggregatedList;
25use Google\Service\Compute\ResourcePolicyList;
26use Google\Service\Compute\TestPermissionsRequest;
27use Google\Service\Compute\TestPermissionsResponse;
28
29/**
30 * The "resourcePolicies" collection of methods.
31 * Typical usage is:
32 * <code>
33 * $computeService = new Google\Service\Compute(...);
34 * $resourcePolicies = $computeService->resourcePolicies;
35 * </code>
36 */
37class ResourcePolicies extends \Google\Service\Resource
38{
39 /**
40 * Retrieves an aggregated list of resource policies. To prevent failure, Google
41 * recommends that you set the `returnPartialSuccess` parameter to `true`.
42 * (resourcePolicies.aggregatedList)
43 *
44 * @param string $project Project ID for this request.
45 * @param array $optParams Optional parameters.
46 *
47 * @opt_param string filter A filter expression that filters resources listed in
48 * the response. Most Compute resources support two types of filter expressions:
49 * expressions that support regular expressions and expressions that follow API
50 * improvement proposal AIP-160. These two types of filter expressions cannot be
51 * mixed in one request. If you want to use AIP-160, your expression must
52 * specify the field name, an operator, and the value that you want to use for
53 * filtering. The value must be a string, a number, or a boolean. The operator
54 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
55 * are filtering Compute Engine instances, you can exclude instances named
56 * `example-instance` by specifying `name != example-instance`. The `:*`
57 * comparison can be used to test whether a key has been defined. For example,
58 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
59 * also filter nested fields. For example, you could specify
60 * `scheduling.automaticRestart = false` to include instances only if they are
61 * not scheduled for automatic restarts. You can use filtering on nested fields
62 * to filter based on resource labels. To filter on multiple expressions,
63 * provide each separate expression within parentheses. For example: ```
64 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
65 * default, each expression is an `AND` expression. However, you can include
66 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
67 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
68 * (scheduling.automaticRestart = true) ``` If you want to use a regular
69 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
70 * single un-parenthesized expression with or without quotes or against multiple
71 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
72 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
73 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
74 * interpreted as a regular expression using Google RE2 library syntax. The
75 * literal value must match the entire field. For example, to filter for
76 * instances that do not end with name "instance", you would use `name ne
77 * .*instance`. You cannot combine constraints on multiple fields using regular
78 * expressions.
79 * @opt_param bool includeAllScopes Indicates whether every visible scope for
80 * each scope type (zone, region, global) should be included in the response.
81 * For new resource types added after this field, the flag has no effect as new
82 * resource types will always include every visible scope for each scope type in
83 * response. For resource types which predate this field, if this flag is
84 * omitted or false, only scopes of the scope types where the resource type is
85 * expected to be found will be included.
86 * @opt_param string maxResults The maximum number of results per page that
87 * should be returned. If the number of available results is larger than
88 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
89 * get the next page of results in subsequent list requests. Acceptable values
90 * are `0` to `500`, inclusive. (Default: `500`)
91 * @opt_param string orderBy Sorts list results by a certain order. By default,
92 * results are returned in alphanumerical order based on the resource name. You
93 * can also sort results in descending order based on the creation timestamp
94 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
95 * `creationTimestamp` field in reverse chronological order (newest result
96 * first). Use this to sort resources like operations so that the newest
97 * operation is returned first. Currently, only sorting by `name` or
98 * `creationTimestamp desc` is supported.
99 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
100 * the `nextPageToken` returned by a previous list request to get the next page
101 * of results.
102 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
103 * which provides partial results in case of failure. The default value is
104 * false. For example, when partial success behavior is enabled, aggregatedList
105 * for a single zone scope either returns all resources in the zone or no
106 * resources, with an error code.
107 * @opt_param string serviceProjectNumber The Shared VPC service project id or
108 * service project number for which aggregated list request is invoked for
109 * subnetworks list-usable api.
110 * @return ResourcePolicyAggregatedList
111 * @throws \Google\Service\Exception
112 */
113 public function aggregatedList($project, $optParams = [])
114 {
115 $params = ['project' => $project];
116 $params = array_merge($params, $optParams);
117 return $this->call('aggregatedList', [$params], ResourcePolicyAggregatedList::class);
118 }
119 /**
120 * Deletes the specified resource policy. (resourcePolicies.delete)
121 *
122 * @param string $project Project ID for this request.
123 * @param string $region Name of the region for this request.
124 * @param string $resourcePolicy Name of the resource policy to delete.
125 * @param array $optParams Optional parameters.
126 *
127 * @opt_param string requestId An optional request ID to identify requests.
128 * Specify a unique request ID so that if you must retry your request, the
129 * server will know to ignore the request if it has already been completed. For
130 * example, consider a situation where you make an initial request and the
131 * request times out. If you make the request again with the same request ID,
132 * the server can check if original operation with the same request ID was
133 * received, and if so, will ignore the second request. This prevents clients
134 * from accidentally creating duplicate commitments. The request ID must be a
135 * valid UUID with the exception that zero UUID is not supported (
136 * 00000000-0000-0000-0000-000000000000).
137 * @return Operation
138 * @throws \Google\Service\Exception
139 */
140 public function delete($project, $region, $resourcePolicy, $optParams = [])
141 {
142 $params = ['project' => $project, 'region' => $region, 'resourcePolicy' => $resourcePolicy];
143 $params = array_merge($params, $optParams);
144 return $this->call('delete', [$params], Operation::class);
145 }
146 /**
147 * Retrieves all information of the specified resource policy.
148 * (resourcePolicies.get)
149 *
150 * @param string $project Project ID for this request.
151 * @param string $region Name of the region for this request.
152 * @param string $resourcePolicy Name of the resource policy to retrieve.
153 * @param array $optParams Optional parameters.
154 * @return ResourcePolicy
155 * @throws \Google\Service\Exception
156 */
157 public function get($project, $region, $resourcePolicy, $optParams = [])
158 {
159 $params = ['project' => $project, 'region' => $region, 'resourcePolicy' => $resourcePolicy];
160 $params = array_merge($params, $optParams);
161 return $this->call('get', [$params], ResourcePolicy::class);
162 }
163 /**
164 * Gets the access control policy for a resource. May be empty if no such policy
165 * or resource exists. (resourcePolicies.getIamPolicy)
166 *
167 * @param string $project Project ID for this request.
168 * @param string $region The name of the region for this request.
169 * @param string $resource Name or id of the resource for this request.
170 * @param array $optParams Optional parameters.
171 *
172 * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version.
173 * @return Policy
174 * @throws \Google\Service\Exception
175 */
176 public function getIamPolicy($project, $region, $resource, $optParams = [])
177 {
178 $params = ['project' => $project, 'region' => $region, 'resource' => $resource];
179 $params = array_merge($params, $optParams);
180 return $this->call('getIamPolicy', [$params], Policy::class);
181 }
182 /**
183 * Creates a new resource policy. (resourcePolicies.insert)
184 *
185 * @param string $project Project ID for this request.
186 * @param string $region Name of the region for this request.
187 * @param ResourcePolicy $postBody
188 * @param array $optParams Optional parameters.
189 *
190 * @opt_param string requestId An optional request ID to identify requests.
191 * Specify a unique request ID so that if you must retry your request, the
192 * server will know to ignore the request if it has already been completed. For
193 * example, consider a situation where you make an initial request and the
194 * request times out. If you make the request again with the same request ID,
195 * the server can check if original operation with the same request ID was
196 * received, and if so, will ignore the second request. This prevents clients
197 * from accidentally creating duplicate commitments. The request ID must be a
198 * valid UUID with the exception that zero UUID is not supported (
199 * 00000000-0000-0000-0000-000000000000).
200 * @return Operation
201 * @throws \Google\Service\Exception
202 */
203 public function insert($project, $region, ResourcePolicy $postBody, $optParams = [])
204 {
205 $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody];
206 $params = array_merge($params, $optParams);
207 return $this->call('insert', [$params], Operation::class);
208 }
209 /**
210 * A list all the resource policies that have been configured for the specified
211 * project in specified region. (resourcePolicies.listResourcePolicies)
212 *
213 * @param string $project Project ID for this request.
214 * @param string $region Name of the region for this request.
215 * @param array $optParams Optional parameters.
216 *
217 * @opt_param string filter A filter expression that filters resources listed in
218 * the response. Most Compute resources support two types of filter expressions:
219 * expressions that support regular expressions and expressions that follow API
220 * improvement proposal AIP-160. These two types of filter expressions cannot be
221 * mixed in one request. If you want to use AIP-160, your expression must
222 * specify the field name, an operator, and the value that you want to use for
223 * filtering. The value must be a string, a number, or a boolean. The operator
224 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
225 * are filtering Compute Engine instances, you can exclude instances named
226 * `example-instance` by specifying `name != example-instance`. The `:*`
227 * comparison can be used to test whether a key has been defined. For example,
228 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
229 * also filter nested fields. For example, you could specify
230 * `scheduling.automaticRestart = false` to include instances only if they are
231 * not scheduled for automatic restarts. You can use filtering on nested fields
232 * to filter based on resource labels. To filter on multiple expressions,
233 * provide each separate expression within parentheses. For example: ```
234 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
235 * default, each expression is an `AND` expression. However, you can include
236 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
237 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
238 * (scheduling.automaticRestart = true) ``` If you want to use a regular
239 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
240 * single un-parenthesized expression with or without quotes or against multiple
241 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
242 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
243 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
244 * interpreted as a regular expression using Google RE2 library syntax. The
245 * literal value must match the entire field. For example, to filter for
246 * instances that do not end with name "instance", you would use `name ne
247 * .*instance`. You cannot combine constraints on multiple fields using regular
248 * expressions.
249 * @opt_param string maxResults The maximum number of results per page that
250 * should be returned. If the number of available results is larger than
251 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
252 * get the next page of results in subsequent list requests. Acceptable values
253 * are `0` to `500`, inclusive. (Default: `500`)
254 * @opt_param string orderBy Sorts list results by a certain order. By default,
255 * results are returned in alphanumerical order based on the resource name. You
256 * can also sort results in descending order based on the creation timestamp
257 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
258 * `creationTimestamp` field in reverse chronological order (newest result
259 * first). Use this to sort resources like operations so that the newest
260 * operation is returned first. Currently, only sorting by `name` or
261 * `creationTimestamp desc` is supported.
262 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
263 * the `nextPageToken` returned by a previous list request to get the next page
264 * of results.
265 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
266 * which provides partial results in case of failure. The default value is
267 * false. For example, when partial success behavior is enabled, aggregatedList
268 * for a single zone scope either returns all resources in the zone or no
269 * resources, with an error code.
270 * @return ResourcePolicyList
271 * @throws \Google\Service\Exception
272 */
273 public function listResourcePolicies($project, $region, $optParams = [])
274 {
275 $params = ['project' => $project, 'region' => $region];
276 $params = array_merge($params, $optParams);
277 return $this->call('list', [$params], ResourcePolicyList::class);
278 }
279 /**
280 * Modify the specified resource policy. (resourcePolicies.patch)
281 *
282 * @param string $project Project ID for this request.
283 * @param string $region Name of the region for this request.
284 * @param string $resourcePolicy Id of the resource policy to patch.
285 * @param ResourcePolicy $postBody
286 * @param array $optParams Optional parameters.
287 *
288 * @opt_param string requestId An optional request ID to identify requests.
289 * Specify a unique request ID so that if you must retry your request, the
290 * server will know to ignore the request if it has already been completed. For
291 * example, consider a situation where you make an initial request and the
292 * request times out. If you make the request again with the same request ID,
293 * the server can check if original operation with the same request ID was
294 * received, and if so, will ignore the second request. This prevents clients
295 * from accidentally creating duplicate commitments. The request ID must be a
296 * valid UUID with the exception that zero UUID is not supported (
297 * 00000000-0000-0000-0000-000000000000).
298 * @opt_param string updateMask update_mask indicates fields to be updated as
299 * part of this request.
300 * @return Operation
301 * @throws \Google\Service\Exception
302 */
303 public function patch($project, $region, $resourcePolicy, ResourcePolicy $postBody, $optParams = [])
304 {
305 $params = ['project' => $project, 'region' => $region, 'resourcePolicy' => $resourcePolicy, 'postBody' => $postBody];
306 $params = array_merge($params, $optParams);
307 return $this->call('patch', [$params], Operation::class);
308 }
309 /**
310 * Sets the access control policy on the specified resource. Replaces any
311 * existing policy. (resourcePolicies.setIamPolicy)
312 *
313 * @param string $project Project ID for this request.
314 * @param string $region The name of the region for this request.
315 * @param string $resource Name or id of the resource for this request.
316 * @param RegionSetPolicyRequest $postBody
317 * @param array $optParams Optional parameters.
318 * @return Policy
319 * @throws \Google\Service\Exception
320 */
321 public function setIamPolicy($project, $region, $resource, RegionSetPolicyRequest $postBody, $optParams = [])
322 {
323 $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody];
324 $params = array_merge($params, $optParams);
325 return $this->call('setIamPolicy', [$params], Policy::class);
326 }
327 /**
328 * Returns permissions that a caller has on the specified resource.
329 * (resourcePolicies.testIamPermissions)
330 *
331 * @param string $project Project ID for this request.
332 * @param string $region The name of the region for this request.
333 * @param string $resource Name or id of the resource for this request.
334 * @param TestPermissionsRequest $postBody
335 * @param array $optParams Optional parameters.
336 * @return TestPermissionsResponse
337 * @throws \Google\Service\Exception
338 */
339 public function testIamPermissions($project, $region, $resource, TestPermissionsRequest $postBody, $optParams = [])
340 {
341 $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody];
342 $params = array_merge($params, $optParams);
343 return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class);
344 }
345}
346
347// Adding a class alias for backwards compatibility with the previous class name.
348class_alias(ResourcePolicies::class, 'Google_Service_Compute_Resource_ResourcePolicies');
Note: See TracBrowser for help on using the repository browser.