source: vendor/google/apiclient-services/src/Compute/Resource/Reservations.php@ e3d4e0a

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

Upload project files

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