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