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 "regionOperations" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $computeService = new Google\Service\Compute(...);
28 *   $regionOperations = $computeService->regionOperations;
29 *  </code>
30 */
31class RegionOperations extends \Google\Service\Resource
32{
33  /**
34   * Deletes the specified region-specific Operations resource.
35   * (regionOperations.delete)
36   *
37   * @param string $project Project ID for this request.
38   * @param string $region Name of the region 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, $region, $operation, $optParams = [])
43  {
44    $params = ['project' => $project, 'region' => $region, 'operation' => $operation];
45    $params = array_merge($params, $optParams);
46    return $this->call('delete', [$params]);
47  }
48  /**
49   * Retrieves the specified region-specific Operations resource.
50   * (regionOperations.get)
51   *
52   * @param string $project Project ID for this request.
53   * @param string $region Name of the region 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, $region, $operation, $optParams = [])
59  {
60    $params = ['project' => $project, 'region' => $region, '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
66   * region. (regionOperations.listRegionOperations)
67   *
68   * @param string $project Project ID for this request.
69   * @param string $region Name of the region for this 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 listRegionOperations($project, $region, $optParams = [])
114  {
115    $params = ['project' => $project, 'region' => $region];
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 differs from the `GET` method in that it
123   * waits for no more than the default deadline (2 minutes) and then returns the
124   * current state of the operation, which might be `DONE` or still in progress.
125   * This method is called on a best-effort basis. Specifically: - In uncommon
126   * cases, when the server is overloaded, the request might return before the
127   * default deadline is reached, or might return after zero seconds. - If the
128   * default deadline is reached, there is no guarantee that the operation is
129   * actually done when the method returns. Be prepared to retry if the operation
130   * is not `DONE`.  (regionOperations.wait)
131   *
132   * @param string $project Project ID for this request.
133   * @param string $region Name of the region for this request.
134   * @param string $operation Name of the Operations resource to return.
135   * @param array $optParams Optional parameters.
136   * @return Operation
137   */
138  public function wait($project, $region, $operation, $optParams = [])
139  {
140    $params = ['project' => $project, 'region' => $region, 'operation' => $operation];
141    $params = array_merge($params, $optParams);
142    return $this->call('wait', [$params], Operation::class);
143  }
144}
145
146// Adding a class alias for backwards compatibility with the previous class name.
147class_alias(RegionOperations::class, 'Google_Service_Compute_Resource_RegionOperations');
148