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\OperationList;
22
23/**
24 * The "zoneOperations" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $computeService = new Google\Service\Compute(...);
28 *   $zoneOperations = $computeService->zoneOperations;
29 *  </code>
30 */
31class ZoneOperations extends \Google\Service\Resource
32{
33  /**
34   * Deletes the specified zone-specific Operations resource.
35   * (zoneOperations.delete)
36   *
37   * @param string $project Project ID for this request.
38   * @param string $zone Name of the zone for this request.
39   * @param string $operation Name of the Operations resource to delete.
40   * @param array $optParams Optional parameters.
41   */
42  public function delete($project, $zone, $operation, $optParams = [])
43  {
44    $params = ['project' => $project, 'zone' => $zone, 'operation' => $operation];
45    $params = array_merge($params, $optParams);
46    return $this->call('delete', [$params]);
47  }
48  /**
49   * Retrieves the specified zone-specific Operations resource.
50   * (zoneOperations.get)
51   *
52   * @param string $project Project ID for this request.
53   * @param string $zone Name of the zone for this request.
54   * @param string $operation Name of the Operations resource to return.
55   * @param array $optParams Optional parameters.
56   * @return Operation
57   */
58  public function get($project, $zone, $operation, $optParams = [])
59  {
60    $params = ['project' => $project, 'zone' => $zone, 'operation' => $operation];
61    $params = array_merge($params, $optParams);
62    return $this->call('get', [$params], Operation::class);
63  }
64  /**
65   * Retrieves a list of Operation resources contained within the specified zone.
66   * (zoneOperations.listZoneOperations)
67   *
68   * @param string $project Project ID for this request.
69   * @param string $zone Name of the zone for request.
70   * @param array $optParams Optional parameters.
71   *
72   * @opt_param string filter A filter expression that filters resources listed in
73   * the response. The expression must specify the field name, an operator, and
74   * the value that you want to use for filtering. The value must be a string, a
75   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
76   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
77   * can exclude instances named `example-instance` by specifying `name !=
78   * example-instance`. The `:` operator can be used with string fields to match
79   * substrings. For non-string fields it is equivalent to the `=` operator. The
80   * `:*` comparison can be used to test whether a key has been defined. For
81   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
82   * You can also filter nested fields. For example, you could specify
83   * `scheduling.automaticRestart = false` to include instances only if they are
84   * not scheduled for automatic restarts. You can use filtering on nested fields
85   * to filter based on resource labels. To filter on multiple expressions,
86   * provide each separate expression within parentheses. For example: ```
87   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
88   * default, each expression is an `AND` expression. However, you can include
89   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
90   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
91   * (scheduling.automaticRestart = true) ```
92   * @opt_param string maxResults The maximum number of results per page that
93   * should be returned. If the number of available results is larger than
94   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
95   * get the next page of results in subsequent list requests. Acceptable values
96   * are `0` to `500`, inclusive. (Default: `500`)
97   * @opt_param string orderBy Sorts list results by a certain order. By default,
98   * results are returned in alphanumerical order based on the resource name. You
99   * can also sort results in descending order based on the creation timestamp
100   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
101   * `creationTimestamp` field in reverse chronological order (newest result
102   * first). Use this to sort resources like operations so that the newest
103   * operation is returned first. Currently, only sorting by `name` or
104   * `creationTimestamp desc` is supported.
105   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
106   * the `nextPageToken` returned by a previous list request to get the next page
107   * of results.
108   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
109   * which provides partial results in case of failure. The default value is
110   * false.
111   * @return OperationList
112   */
113  public function listZoneOperations($project, $zone, $optParams = [])
114  {
115    $params = ['project' => $project, 'zone' => $zone];
116    $params = array_merge($params, $optParams);
117    return $this->call('list', [$params], OperationList::class);
118  }
119  /**
120   * Waits for the specified Operation resource to return as `DONE` or for the
121   * request to approach the 2 minute deadline, and retrieves the specified
122   * Operation resource. This method waits for no more than the 2 minutes and then
123   * returns the current state of the operation, which might be `DONE` or still in
124   * progress. This method is called on a best-effort basis. Specifically: - In
125   * uncommon cases, when the server is overloaded, the request might return
126   * before the default deadline is reached, or might return after zero seconds. -
127   * If the default deadline is reached, there is no guarantee that the operation
128   * is actually done when the method returns. Be prepared to retry if the
129   * operation is not `DONE`.  (zoneOperations.wait)
130   *
131   * @param string $project Project ID for this request.
132   * @param string $zone Name of the zone for this request.
133   * @param string $operation Name of the Operations resource to return.
134   * @param array $optParams Optional parameters.
135   * @return Operation
136   */
137  public function wait($project, $zone, $operation, $optParams = [])
138  {
139    $params = ['project' => $project, 'zone' => $zone, 'operation' => $operation];
140    $params = array_merge($params, $optParams);
141    return $this->call('wait', [$params], Operation::class);
142  }
143}
144
145// Adding a class alias for backwards compatibility with the previous class name.
146class_alias(ZoneOperations::class, 'Google_Service_Compute_Resource_ZoneOperations');
147