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