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\Autoscaler;
21use Google\Service\Compute\AutoscalerAggregatedList;
22use Google\Service\Compute\AutoscalerList;
23use Google\Service\Compute\Operation;
24
25/**
26 * The "autoscalers" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $computeService = new Google\Service\Compute(...);
30 *   $autoscalers = $computeService->autoscalers;
31 *  </code>
32 */
33class Autoscalers extends \Google\Service\Resource
34{
35  /**
36   * Retrieves an aggregated list of autoscalers. (autoscalers.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 AutoscalerAggregatedList
88   */
89  public function aggregatedList($project, $optParams = [])
90  {
91    $params = ['project' => $project];
92    $params = array_merge($params, $optParams);
93    return $this->call('aggregatedList', [$params], AutoscalerAggregatedList::class);
94  }
95  /**
96   * Deletes the specified autoscaler. (autoscalers.delete)
97   *
98   * @param string $project Project ID for this request.
99   * @param string $zone Name of the zone for this request.
100   * @param string $autoscaler Name of the autoscaler to delete.
101   * @param array $optParams Optional parameters.
102   *
103   * @opt_param string requestId An optional request ID to identify requests.
104   * Specify a unique request ID so that if you must retry your request, the
105   * server will know to ignore the request if it has already been completed. For
106   * example, consider a situation where you make an initial request and the
107   * request times out. If you make the request again with the same request ID,
108   * the server can check if original operation with the same request ID was
109   * received, and if so, will ignore the second request. This prevents clients
110   * from accidentally creating duplicate commitments. The request ID must be a
111   * valid UUID with the exception that zero UUID is not supported (
112   * 00000000-0000-0000-0000-000000000000).
113   * @return Operation
114   */
115  public function delete($project, $zone, $autoscaler, $optParams = [])
116  {
117    $params = ['project' => $project, 'zone' => $zone, 'autoscaler' => $autoscaler];
118    $params = array_merge($params, $optParams);
119    return $this->call('delete', [$params], Operation::class);
120  }
121  /**
122   * Returns the specified autoscaler resource. Gets a list of available
123   * autoscalers by making a list() request. (autoscalers.get)
124   *
125   * @param string $project Project ID for this request.
126   * @param string $zone Name of the zone for this request.
127   * @param string $autoscaler Name of the autoscaler to return.
128   * @param array $optParams Optional parameters.
129   * @return Autoscaler
130   */
131  public function get($project, $zone, $autoscaler, $optParams = [])
132  {
133    $params = ['project' => $project, 'zone' => $zone, 'autoscaler' => $autoscaler];
134    $params = array_merge($params, $optParams);
135    return $this->call('get', [$params], Autoscaler::class);
136  }
137  /**
138   * Creates an autoscaler in the specified project using the data included in the
139   * request. (autoscalers.insert)
140   *
141   * @param string $project Project ID for this request.
142   * @param string $zone Name of the zone for this request.
143   * @param Autoscaler $postBody
144   * @param array $optParams Optional parameters.
145   *
146   * @opt_param string requestId An optional request ID to identify requests.
147   * Specify a unique request ID so that if you must retry your request, the
148   * server will know to ignore the request if it has already been completed. For
149   * example, consider a situation where you make an initial request and the
150   * request times out. If you make the request again with the same request ID,
151   * the server can check if original operation with the same request ID was
152   * received, and if so, will ignore the second request. This prevents clients
153   * from accidentally creating duplicate commitments. The request ID must be a
154   * valid UUID with the exception that zero UUID is not supported (
155   * 00000000-0000-0000-0000-000000000000).
156   * @return Operation
157   */
158  public function insert($project, $zone, Autoscaler $postBody, $optParams = [])
159  {
160    $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody];
161    $params = array_merge($params, $optParams);
162    return $this->call('insert', [$params], Operation::class);
163  }
164  /**
165   * Retrieves a list of autoscalers contained within the specified zone.
166   * (autoscalers.listAutoscalers)
167   *
168   * @param string $project Project ID for this request.
169   * @param string $zone Name of the zone for this request.
170   * @param array $optParams Optional parameters.
171   *
172   * @opt_param string filter A filter expression that filters resources listed in
173   * the response. The expression must specify the field name, an operator, and
174   * the value that you want to use for filtering. The value must be a string, a
175   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
176   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
177   * can exclude instances named `example-instance` by specifying `name !=
178   * example-instance`. The `:` operator can be used with string fields to match
179   * substrings. For non-string fields it is equivalent to the `=` operator. The
180   * `:*` comparison can be used to test whether a key has been defined. For
181   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
182   * You can also filter nested fields. For example, you could specify
183   * `scheduling.automaticRestart = false` to include instances only if they are
184   * not scheduled for automatic restarts. You can use filtering on nested fields
185   * to filter based on resource labels. To filter on multiple expressions,
186   * provide each separate expression within parentheses. For example: ```
187   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
188   * default, each expression is an `AND` expression. However, you can include
189   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
190   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
191   * (scheduling.automaticRestart = true) ```
192   * @opt_param string maxResults The maximum number of results per page that
193   * should be returned. If the number of available results is larger than
194   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
195   * get the next page of results in subsequent list requests. Acceptable values
196   * are `0` to `500`, inclusive. (Default: `500`)
197   * @opt_param string orderBy Sorts list results by a certain order. By default,
198   * results are returned in alphanumerical order based on the resource name. You
199   * can also sort results in descending order based on the creation timestamp
200   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
201   * `creationTimestamp` field in reverse chronological order (newest result
202   * first). Use this to sort resources like operations so that the newest
203   * operation is returned first. Currently, only sorting by `name` or
204   * `creationTimestamp desc` is supported.
205   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
206   * the `nextPageToken` returned by a previous list request to get the next page
207   * of results.
208   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
209   * which provides partial results in case of failure. The default value is
210   * false.
211   * @return AutoscalerList
212   */
213  public function listAutoscalers($project, $zone, $optParams = [])
214  {
215    $params = ['project' => $project, 'zone' => $zone];
216    $params = array_merge($params, $optParams);
217    return $this->call('list', [$params], AutoscalerList::class);
218  }
219  /**
220   * Updates an autoscaler in the specified project using the data included in the
221   * request. This method supports PATCH semantics and uses the JSON merge patch
222   * format and processing rules. (autoscalers.patch)
223   *
224   * @param string $project Project ID for this request.
225   * @param string $zone Name of the zone for this request.
226   * @param Autoscaler $postBody
227   * @param array $optParams Optional parameters.
228   *
229   * @opt_param string autoscaler Name of the autoscaler to patch.
230   * @opt_param string requestId An optional request ID to identify requests.
231   * Specify a unique request ID so that if you must retry your request, the
232   * server will know to ignore the request if it has already been completed. For
233   * example, consider a situation where you make an initial request and the
234   * request times out. If you make the request again with the same request ID,
235   * the server can check if original operation with the same request ID was
236   * received, and if so, will ignore the second request. This prevents clients
237   * from accidentally creating duplicate commitments. The request ID must be a
238   * valid UUID with the exception that zero UUID is not supported (
239   * 00000000-0000-0000-0000-000000000000).
240   * @return Operation
241   */
242  public function patch($project, $zone, Autoscaler $postBody, $optParams = [])
243  {
244    $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody];
245    $params = array_merge($params, $optParams);
246    return $this->call('patch', [$params], Operation::class);
247  }
248  /**
249   * Updates an autoscaler in the specified project using the data included in the
250   * request. (autoscalers.update)
251   *
252   * @param string $project Project ID for this request.
253   * @param string $zone Name of the zone for this request.
254   * @param Autoscaler $postBody
255   * @param array $optParams Optional parameters.
256   *
257   * @opt_param string autoscaler Name of the autoscaler to update.
258   * @opt_param string requestId An optional request ID to identify requests.
259   * Specify a unique request ID so that if you must retry your request, the
260   * server will know to ignore the request if it has already been completed. For
261   * example, consider a situation where you make an initial request and the
262   * request times out. If you make the request again with the same request ID,
263   * the server can check if original operation with the same request ID was
264   * received, and if so, will ignore the second request. This prevents clients
265   * from accidentally creating duplicate commitments. The request ID must be a
266   * valid UUID with the exception that zero UUID is not supported (
267   * 00000000-0000-0000-0000-000000000000).
268   * @return Operation
269   */
270  public function update($project, $zone, Autoscaler $postBody, $optParams = [])
271  {
272    $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody];
273    $params = array_merge($params, $optParams);
274    return $this->call('update', [$params], Operation::class);
275  }
276}
277
278// Adding a class alias for backwards compatibility with the previous class name.
279class_alias(Autoscalers::class, 'Google_Service_Compute_Resource_Autoscalers');
280