1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18/**
19 * The "regionDisks" collection of methods.
20 * Typical usage is:
21 *  <code>
22 *   $computeService = new Google_Service_Compute(...);
23 *   $regionDisks = $computeService->regionDisks;
24 *  </code>
25 */
26class Google_Service_Compute_Resource_RegionDisks extends Google_Service_Resource
27{
28  /**
29   * Adds existing resource policies to a regional disk. You can only add one
30   * policy which will be applied to this disk for scheduling snapshot creation.
31   * (regionDisks.addResourcePolicies)
32   *
33   * @param string $project Project ID for this request.
34   * @param string $region The name of the region for this request.
35   * @param string $disk The disk name for this request.
36   * @param Google_Service_Compute_RegionDisksAddResourcePoliciesRequest $postBody
37   * @param array $optParams Optional parameters.
38   *
39   * @opt_param string requestId An optional request ID to identify requests.
40   * Specify a unique request ID so that if you must retry your request, the
41   * server will know to ignore the request if it has already been completed.
42   *
43   * For example, consider a situation where you make an initial request and the
44   * request times out. If you make the request again with the same request ID,
45   * the server can check if original operation with the same request ID was
46   * received, and if so, will ignore the second request. This prevents clients
47   * from accidentally creating duplicate commitments.
48   *
49   * The request ID must be a valid UUID with the exception that zero UUID is not
50   * supported (00000000-0000-0000-0000-000000000000).
51   * @return Google_Service_Compute_Operation
52   */
53  public function addResourcePolicies($project, $region, $disk, Google_Service_Compute_RegionDisksAddResourcePoliciesRequest $postBody, $optParams = array())
54  {
55    $params = array('project' => $project, 'region' => $region, 'disk' => $disk, 'postBody' => $postBody);
56    $params = array_merge($params, $optParams);
57    return $this->call('addResourcePolicies', array($params), "Google_Service_Compute_Operation");
58  }
59  /**
60   * Creates a snapshot of this regional disk. (regionDisks.createSnapshot)
61   *
62   * @param string $project Project ID for this request.
63   * @param string $region Name of the region for this request.
64   * @param string $disk Name of the regional persistent disk to snapshot.
65   * @param Google_Service_Compute_Snapshot $postBody
66   * @param array $optParams Optional parameters.
67   *
68   * @opt_param string requestId An optional request ID to identify requests.
69   * Specify a unique request ID so that if you must retry your request, the
70   * server will know to ignore the request if it has already been completed.
71   *
72   * For example, consider a situation where you make an initial request and the
73   * request times out. If you make the request again with the same request ID,
74   * the server can check if original operation with the same request ID was
75   * received, and if so, will ignore the second request. This prevents clients
76   * from accidentally creating duplicate commitments.
77   *
78   * The request ID must be a valid UUID with the exception that zero UUID is not
79   * supported (00000000-0000-0000-0000-000000000000).
80   * @return Google_Service_Compute_Operation
81   */
82  public function createSnapshot($project, $region, $disk, Google_Service_Compute_Snapshot $postBody, $optParams = array())
83  {
84    $params = array('project' => $project, 'region' => $region, 'disk' => $disk, 'postBody' => $postBody);
85    $params = array_merge($params, $optParams);
86    return $this->call('createSnapshot', array($params), "Google_Service_Compute_Operation");
87  }
88  /**
89   * Deletes the specified regional persistent disk. Deleting a regional disk
90   * removes all the replicas of its data permanently and is irreversible.
91   * However, deleting a disk does not delete any snapshots previously made from
92   * the disk. You must separately delete snapshots. (regionDisks.delete)
93   *
94   * @param string $project Project ID for this request.
95   * @param string $region Name of the region for this request.
96   * @param string $disk Name of the regional persistent disk to delete.
97   * @param array $optParams Optional parameters.
98   *
99   * @opt_param string requestId An optional request ID to identify requests.
100   * Specify a unique request ID so that if you must retry your request, the
101   * server will know to ignore the request if it has already been completed.
102   *
103   * For example, consider a situation where you make an initial request and the
104   * request times out. If you make the request again with the same request ID,
105   * the server can check if original operation with the same request ID was
106   * received, and if so, will ignore the second request. This prevents clients
107   * from accidentally creating duplicate commitments.
108   *
109   * The request ID must be a valid UUID with the exception that zero UUID is not
110   * supported (00000000-0000-0000-0000-000000000000).
111   * @return Google_Service_Compute_Operation
112   */
113  public function delete($project, $region, $disk, $optParams = array())
114  {
115    $params = array('project' => $project, 'region' => $region, 'disk' => $disk);
116    $params = array_merge($params, $optParams);
117    return $this->call('delete', array($params), "Google_Service_Compute_Operation");
118  }
119  /**
120   * Returns a specified regional persistent disk. (regionDisks.get)
121   *
122   * @param string $project Project ID for this request.
123   * @param string $region Name of the region for this request.
124   * @param string $disk Name of the regional persistent disk to return.
125   * @param array $optParams Optional parameters.
126   * @return Google_Service_Compute_Disk
127   */
128  public function get($project, $region, $disk, $optParams = array())
129  {
130    $params = array('project' => $project, 'region' => $region, 'disk' => $disk);
131    $params = array_merge($params, $optParams);
132    return $this->call('get', array($params), "Google_Service_Compute_Disk");
133  }
134  /**
135   * Gets the access control policy for a resource. May be empty if no such policy
136   * or resource exists. (regionDisks.getIamPolicy)
137   *
138   * @param string $project Project ID for this request.
139   * @param string $region The name of the region for this request.
140   * @param string $resource Name or id of the resource for this request.
141   * @param array $optParams Optional parameters.
142   *
143   * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version.
144   * @return Google_Service_Compute_Policy
145   */
146  public function getIamPolicy($project, $region, $resource, $optParams = array())
147  {
148    $params = array('project' => $project, 'region' => $region, 'resource' => $resource);
149    $params = array_merge($params, $optParams);
150    return $this->call('getIamPolicy', array($params), "Google_Service_Compute_Policy");
151  }
152  /**
153   * Creates a persistent regional disk in the specified project using the data
154   * included in the request. (regionDisks.insert)
155   *
156   * @param string $project Project ID for this request.
157   * @param string $region Name of the region for this request.
158   * @param Google_Service_Compute_Disk $postBody
159   * @param array $optParams Optional parameters.
160   *
161   * @opt_param string requestId An optional request ID to identify requests.
162   * Specify a unique request ID so that if you must retry your request, the
163   * server will know to ignore the request if it has already been completed.
164   *
165   * For example, consider a situation where you make an initial request and the
166   * request times out. If you make the request again with the same request ID,
167   * the server can check if original operation with the same request ID was
168   * received, and if so, will ignore the second request. This prevents clients
169   * from accidentally creating duplicate commitments.
170   *
171   * The request ID must be a valid UUID with the exception that zero UUID is not
172   * supported (00000000-0000-0000-0000-000000000000).
173   * @opt_param string sourceImage Source image to restore onto a disk. This field
174   * is optional.
175   * @return Google_Service_Compute_Operation
176   */
177  public function insert($project, $region, Google_Service_Compute_Disk $postBody, $optParams = array())
178  {
179    $params = array('project' => $project, 'region' => $region, 'postBody' => $postBody);
180    $params = array_merge($params, $optParams);
181    return $this->call('insert', array($params), "Google_Service_Compute_Operation");
182  }
183  /**
184   * Retrieves the list of persistent disks contained within the specified region.
185   * (regionDisks.listRegionDisks)
186   *
187   * @param string $project Project ID for this request.
188   * @param string $region Name of the region for this request.
189   * @param array $optParams Optional parameters.
190   *
191   * @opt_param string filter A filter expression that filters resources listed in
192   * the response. The expression must specify the field name, a comparison
193   * operator, and the value that you want to use for filtering. The value must be
194   * a string, a number, or a boolean. The comparison operator must be either `=`,
195   * `!=`, `>`, or `<`.
196   *
197   * For example, if you are filtering Compute Engine instances, you can exclude
198   * instances named `example-instance` by specifying `name != example-instance`.
199   *
200   * You can also filter nested fields. For example, you could specify
201   * `scheduling.automaticRestart = false` to include instances only if they are
202   * not scheduled for automatic restarts. You can use filtering on nested fields
203   * to filter based on resource labels.
204   *
205   * To filter on multiple expressions, provide each separate expression within
206   * parentheses. For example: ``` (scheduling.automaticRestart = true)
207   * (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND`
208   * expression. However, you can include `AND` and `OR` expressions explicitly.
209   * For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel
210   * Broadwell") AND (scheduling.automaticRestart = true) ```
211   * @opt_param string maxResults The maximum number of results per page that
212   * should be returned. If the number of available results is larger than
213   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
214   * get the next page of results in subsequent list requests. Acceptable values
215   * are `0` to `500`, inclusive. (Default: `500`)
216   * @opt_param string orderBy Sorts list results by a certain order. By default,
217   * results are returned in alphanumerical order based on the resource name.
218   *
219   * You can also sort results in descending order based on the creation timestamp
220   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
221   * `creationTimestamp` field in reverse chronological order (newest result
222   * first). Use this to sort resources like operations so that the newest
223   * operation is returned first.
224   *
225   * Currently, only sorting by `name` or `creationTimestamp desc` is supported.
226   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
227   * the `nextPageToken` returned by a previous list request to get the next page
228   * of results.
229   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
230   * which provides partial results in case of failure. The default value is
231   * false.
232   * @return Google_Service_Compute_DiskList
233   */
234  public function listRegionDisks($project, $region, $optParams = array())
235  {
236    $params = array('project' => $project, 'region' => $region);
237    $params = array_merge($params, $optParams);
238    return $this->call('list', array($params), "Google_Service_Compute_DiskList");
239  }
240  /**
241   * Removes resource policies from a regional disk.
242   * (regionDisks.removeResourcePolicies)
243   *
244   * @param string $project Project ID for this request.
245   * @param string $region The name of the region for this request.
246   * @param string $disk The disk name for this request.
247   * @param Google_Service_Compute_RegionDisksRemoveResourcePoliciesRequest $postBody
248   * @param array $optParams Optional parameters.
249   *
250   * @opt_param string requestId An optional request ID to identify requests.
251   * Specify a unique request ID so that if you must retry your request, the
252   * server will know to ignore the request if it has already been completed.
253   *
254   * For example, consider a situation where you make an initial request and the
255   * request times out. If you make the request again with the same request ID,
256   * the server can check if original operation with the same request ID was
257   * received, and if so, will ignore the second request. This prevents clients
258   * from accidentally creating duplicate commitments.
259   *
260   * The request ID must be a valid UUID with the exception that zero UUID is not
261   * supported (00000000-0000-0000-0000-000000000000).
262   * @return Google_Service_Compute_Operation
263   */
264  public function removeResourcePolicies($project, $region, $disk, Google_Service_Compute_RegionDisksRemoveResourcePoliciesRequest $postBody, $optParams = array())
265  {
266    $params = array('project' => $project, 'region' => $region, 'disk' => $disk, 'postBody' => $postBody);
267    $params = array_merge($params, $optParams);
268    return $this->call('removeResourcePolicies', array($params), "Google_Service_Compute_Operation");
269  }
270  /**
271   * Resizes the specified regional persistent disk. (regionDisks.resize)
272   *
273   * @param string $project The project ID for this request.
274   * @param string $region Name of the region for this request.
275   * @param string $disk Name of the regional persistent disk.
276   * @param Google_Service_Compute_RegionDisksResizeRequest $postBody
277   * @param array $optParams Optional parameters.
278   *
279   * @opt_param string requestId An optional request ID to identify requests.
280   * Specify a unique request ID so that if you must retry your request, the
281   * server will know to ignore the request if it has already been completed.
282   *
283   * For example, consider a situation where you make an initial request and the
284   * request times out. If you make the request again with the same request ID,
285   * the server can check if original operation with the same request ID was
286   * received, and if so, will ignore the second request. This prevents clients
287   * from accidentally creating duplicate commitments.
288   *
289   * The request ID must be a valid UUID with the exception that zero UUID is not
290   * supported (00000000-0000-0000-0000-000000000000).
291   * @return Google_Service_Compute_Operation
292   */
293  public function resize($project, $region, $disk, Google_Service_Compute_RegionDisksResizeRequest $postBody, $optParams = array())
294  {
295    $params = array('project' => $project, 'region' => $region, 'disk' => $disk, 'postBody' => $postBody);
296    $params = array_merge($params, $optParams);
297    return $this->call('resize', array($params), "Google_Service_Compute_Operation");
298  }
299  /**
300   * Sets the access control policy on the specified resource. Replaces any
301   * existing policy. (regionDisks.setIamPolicy)
302   *
303   * @param string $project Project ID for this request.
304   * @param string $region The name of the region for this request.
305   * @param string $resource Name or id of the resource for this request.
306   * @param Google_Service_Compute_RegionSetPolicyRequest $postBody
307   * @param array $optParams Optional parameters.
308   * @return Google_Service_Compute_Policy
309   */
310  public function setIamPolicy($project, $region, $resource, Google_Service_Compute_RegionSetPolicyRequest $postBody, $optParams = array())
311  {
312    $params = array('project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody);
313    $params = array_merge($params, $optParams);
314    return $this->call('setIamPolicy', array($params), "Google_Service_Compute_Policy");
315  }
316  /**
317   * Sets the labels on the target regional disk. (regionDisks.setLabels)
318   *
319   * @param string $project Project ID for this request.
320   * @param string $region The region for this request.
321   * @param string $resource Name or id of the resource for this request.
322   * @param Google_Service_Compute_RegionSetLabelsRequest $postBody
323   * @param array $optParams Optional parameters.
324   *
325   * @opt_param string requestId An optional request ID to identify requests.
326   * Specify a unique request ID so that if you must retry your request, the
327   * server will know to ignore the request if it has already been completed.
328   *
329   * For example, consider a situation where you make an initial request and the
330   * request times out. If you make the request again with the same request ID,
331   * the server can check if original operation with the same request ID was
332   * received, and if so, will ignore the second request. This prevents clients
333   * from accidentally creating duplicate commitments.
334   *
335   * The request ID must be a valid UUID with the exception that zero UUID is not
336   * supported (00000000-0000-0000-0000-000000000000).
337   * @return Google_Service_Compute_Operation
338   */
339  public function setLabels($project, $region, $resource, Google_Service_Compute_RegionSetLabelsRequest $postBody, $optParams = array())
340  {
341    $params = array('project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody);
342    $params = array_merge($params, $optParams);
343    return $this->call('setLabels', array($params), "Google_Service_Compute_Operation");
344  }
345  /**
346   * Returns permissions that a caller has on the specified resource.
347   * (regionDisks.testIamPermissions)
348   *
349   * @param string $project Project ID for this request.
350   * @param string $region The name of the region for this request.
351   * @param string $resource Name or id of the resource for this request.
352   * @param Google_Service_Compute_TestPermissionsRequest $postBody
353   * @param array $optParams Optional parameters.
354   * @return Google_Service_Compute_TestPermissionsResponse
355   */
356  public function testIamPermissions($project, $region, $resource, Google_Service_Compute_TestPermissionsRequest $postBody, $optParams = array())
357  {
358    $params = array('project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody);
359    $params = array_merge($params, $optParams);
360    return $this->call('testIamPermissions', array($params), "Google_Service_Compute_TestPermissionsResponse");
361  }
362}
363