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\BackendService;
21use Google\Service\Compute\BackendServiceAggregatedList;
22use Google\Service\Compute\BackendServiceGroupHealth;
23use Google\Service\Compute\BackendServiceList;
24use Google\Service\Compute\Operation;
25use Google\Service\Compute\ResourceGroupReference;
26use Google\Service\Compute\SecurityPolicyReference;
27use Google\Service\Compute\SignedUrlKey;
28
29/**
30 * The "backendServices" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $computeService = new Google\Service\Compute(...);
34 *   $backendServices = $computeService->backendServices;
35 *  </code>
36 */
37class BackendServices extends \Google\Service\Resource
38{
39  /**
40   * Adds a key for validating requests with signed URLs for this backend service.
41   * (backendServices.addSignedUrlKey)
42   *
43   * @param string $project Project ID for this request.
44   * @param string $backendService Name of the BackendService resource to which
45   * the Signed URL Key should be added. The name should conform to RFC1035.
46   * @param SignedUrlKey $postBody
47   * @param array $optParams Optional parameters.
48   *
49   * @opt_param string requestId An optional request ID to identify requests.
50   * Specify a unique request ID so that if you must retry your request, the
51   * server will know to ignore the request if it has already been completed. For
52   * example, consider a situation where you make an initial request and the
53   * request times out. If you make the request again with the same request ID,
54   * the server can check if original operation with the same request ID was
55   * received, and if so, will ignore the second request. This prevents clients
56   * from accidentally creating duplicate commitments. The request ID must be a
57   * valid UUID with the exception that zero UUID is not supported (
58   * 00000000-0000-0000-0000-000000000000).
59   * @return Operation
60   */
61  public function addSignedUrlKey($project, $backendService, SignedUrlKey $postBody, $optParams = [])
62  {
63    $params = ['project' => $project, 'backendService' => $backendService, 'postBody' => $postBody];
64    $params = array_merge($params, $optParams);
65    return $this->call('addSignedUrlKey', [$params], Operation::class);
66  }
67  /**
68   * Retrieves the list of all BackendService resources, regional and global,
69   * available to the specified project. (backendServices.aggregatedList)
70   *
71   * @param string $project Name of the project scoping this request.
72   * @param array $optParams Optional parameters.
73   *
74   * @opt_param string filter A filter expression that filters resources listed in
75   * the response. The expression must specify the field name, an operator, and
76   * the value that you want to use for filtering. The value must be a string, a
77   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
78   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
79   * can exclude instances named `example-instance` by specifying `name !=
80   * example-instance`. The `:` operator can be used with string fields to match
81   * substrings. For non-string fields it is equivalent to the `=` operator. The
82   * `:*` comparison can be used to test whether a key has been defined. For
83   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
84   * You can also filter nested fields. For example, you could specify
85   * `scheduling.automaticRestart = false` to include instances only if they are
86   * not scheduled for automatic restarts. You can use filtering on nested fields
87   * to filter based on resource labels. To filter on multiple expressions,
88   * provide each separate expression within parentheses. For example: ```
89   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
90   * default, each expression is an `AND` expression. However, you can include
91   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
92   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
93   * (scheduling.automaticRestart = true) ```
94   * @opt_param bool includeAllScopes Indicates whether every visible scope for
95   * each scope type (zone, region, global) should be included in the response.
96   * For new resource types added after this field, the flag has no effect as new
97   * resource types will always include every visible scope for each scope type in
98   * response. For resource types which predate this field, if this flag is
99   * omitted or false, only scopes of the scope types where the resource type is
100   * expected to be found will be included.
101   * @opt_param string maxResults The maximum number of results per page that
102   * should be returned. If the number of available results is larger than
103   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
104   * get the next page of results in subsequent list requests. Acceptable values
105   * are `0` to `500`, inclusive. (Default: `500`)
106   * @opt_param string orderBy Sorts list results by a certain order. By default,
107   * results are returned in alphanumerical order based on the resource name. You
108   * can also sort results in descending order based on the creation timestamp
109   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
110   * `creationTimestamp` field in reverse chronological order (newest result
111   * first). Use this to sort resources like operations so that the newest
112   * operation is returned first. Currently, only sorting by `name` or
113   * `creationTimestamp desc` is supported.
114   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
115   * the `nextPageToken` returned by a previous list request to get the next page
116   * of results.
117   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
118   * which provides partial results in case of failure. The default value is
119   * false.
120   * @return BackendServiceAggregatedList
121   */
122  public function aggregatedList($project, $optParams = [])
123  {
124    $params = ['project' => $project];
125    $params = array_merge($params, $optParams);
126    return $this->call('aggregatedList', [$params], BackendServiceAggregatedList::class);
127  }
128  /**
129   * Deletes the specified BackendService resource. (backendServices.delete)
130   *
131   * @param string $project Project ID for this request.
132   * @param string $backendService Name of the BackendService resource to delete.
133   * @param array $optParams Optional parameters.
134   *
135   * @opt_param string requestId An optional request ID to identify requests.
136   * Specify a unique request ID so that if you must retry your request, the
137   * server will know to ignore the request if it has already been completed. For
138   * example, consider a situation where you make an initial request and the
139   * request times out. If you make the request again with the same request ID,
140   * the server can check if original operation with the same request ID was
141   * received, and if so, will ignore the second request. This prevents clients
142   * from accidentally creating duplicate commitments. The request ID must be a
143   * valid UUID with the exception that zero UUID is not supported (
144   * 00000000-0000-0000-0000-000000000000).
145   * @return Operation
146   */
147  public function delete($project, $backendService, $optParams = [])
148  {
149    $params = ['project' => $project, 'backendService' => $backendService];
150    $params = array_merge($params, $optParams);
151    return $this->call('delete', [$params], Operation::class);
152  }
153  /**
154   * Deletes a key for validating requests with signed URLs for this backend
155   * service. (backendServices.deleteSignedUrlKey)
156   *
157   * @param string $project Project ID for this request.
158   * @param string $backendService Name of the BackendService resource to which
159   * the Signed URL Key should be added. The name should conform to RFC1035.
160   * @param string $keyName The name of the Signed URL Key to delete.
161   * @param array $optParams Optional parameters.
162   *
163   * @opt_param string requestId An optional request ID to identify requests.
164   * Specify a unique request ID so that if you must retry your request, the
165   * server will know to ignore the request if it has already been completed. For
166   * example, consider a situation where you make an initial request and the
167   * request times out. If you make the request again with the same request ID,
168   * the server can check if original operation with the same request ID was
169   * received, and if so, will ignore the second request. This prevents clients
170   * from accidentally creating duplicate commitments. The request ID must be a
171   * valid UUID with the exception that zero UUID is not supported (
172   * 00000000-0000-0000-0000-000000000000).
173   * @return Operation
174   */
175  public function deleteSignedUrlKey($project, $backendService, $keyName, $optParams = [])
176  {
177    $params = ['project' => $project, 'backendService' => $backendService, 'keyName' => $keyName];
178    $params = array_merge($params, $optParams);
179    return $this->call('deleteSignedUrlKey', [$params], Operation::class);
180  }
181  /**
182   * Returns the specified BackendService resource. Gets a list of available
183   * backend services. (backendServices.get)
184   *
185   * @param string $project Project ID for this request.
186   * @param string $backendService Name of the BackendService resource to return.
187   * @param array $optParams Optional parameters.
188   * @return BackendService
189   */
190  public function get($project, $backendService, $optParams = [])
191  {
192    $params = ['project' => $project, 'backendService' => $backendService];
193    $params = array_merge($params, $optParams);
194    return $this->call('get', [$params], BackendService::class);
195  }
196  /**
197   * Gets the most recent health check results for this BackendService. Example
198   * request body: { "group": "/zones/us-east1-b/instanceGroups/lb-backend-
199   * example" } (backendServices.getHealth)
200   *
201   * @param string $project
202   * @param string $backendService Name of the BackendService resource to which
203   * the queried instance belongs.
204   * @param ResourceGroupReference $postBody
205   * @param array $optParams Optional parameters.
206   * @return BackendServiceGroupHealth
207   */
208  public function getHealth($project, $backendService, ResourceGroupReference $postBody, $optParams = [])
209  {
210    $params = ['project' => $project, 'backendService' => $backendService, 'postBody' => $postBody];
211    $params = array_merge($params, $optParams);
212    return $this->call('getHealth', [$params], BackendServiceGroupHealth::class);
213  }
214  /**
215   * Creates a BackendService resource in the specified project using the data
216   * included in the request. For more information, see Backend services overview
217   * . (backendServices.insert)
218   *
219   * @param string $project Project ID for this request.
220   * @param BackendService $postBody
221   * @param array $optParams Optional parameters.
222   *
223   * @opt_param string requestId An optional request ID to identify requests.
224   * Specify a unique request ID so that if you must retry your request, the
225   * server will know to ignore the request if it has already been completed. For
226   * example, consider a situation where you make an initial request and the
227   * request times out. If you make the request again with the same request ID,
228   * the server can check if original operation with the same request ID was
229   * received, and if so, will ignore the second request. This prevents clients
230   * from accidentally creating duplicate commitments. The request ID must be a
231   * valid UUID with the exception that zero UUID is not supported (
232   * 00000000-0000-0000-0000-000000000000).
233   * @return Operation
234   */
235  public function insert($project, BackendService $postBody, $optParams = [])
236  {
237    $params = ['project' => $project, 'postBody' => $postBody];
238    $params = array_merge($params, $optParams);
239    return $this->call('insert', [$params], Operation::class);
240  }
241  /**
242   * Retrieves the list of BackendService resources available to the specified
243   * project. (backendServices.listBackendServices)
244   *
245   * @param string $project Project ID for this request.
246   * @param array $optParams Optional parameters.
247   *
248   * @opt_param string filter A filter expression that filters resources listed in
249   * the response. The expression must specify the field name, an operator, and
250   * the value that you want to use for filtering. The value must be a string, a
251   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
252   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
253   * can exclude instances named `example-instance` by specifying `name !=
254   * example-instance`. The `:` operator can be used with string fields to match
255   * substrings. For non-string fields it is equivalent to the `=` operator. The
256   * `:*` comparison can be used to test whether a key has been defined. For
257   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
258   * You can also filter nested fields. For example, you could specify
259   * `scheduling.automaticRestart = false` to include instances only if they are
260   * not scheduled for automatic restarts. You can use filtering on nested fields
261   * to filter based on resource labels. To filter on multiple expressions,
262   * provide each separate expression within parentheses. For example: ```
263   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
264   * default, each expression is an `AND` expression. However, you can include
265   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
266   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
267   * (scheduling.automaticRestart = true) ```
268   * @opt_param string maxResults The maximum number of results per page that
269   * should be returned. If the number of available results is larger than
270   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
271   * get the next page of results in subsequent list requests. Acceptable values
272   * are `0` to `500`, inclusive. (Default: `500`)
273   * @opt_param string orderBy Sorts list results by a certain order. By default,
274   * results are returned in alphanumerical order based on the resource name. You
275   * can also sort results in descending order based on the creation timestamp
276   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
277   * `creationTimestamp` field in reverse chronological order (newest result
278   * first). Use this to sort resources like operations so that the newest
279   * operation is returned first. Currently, only sorting by `name` or
280   * `creationTimestamp desc` is supported.
281   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
282   * the `nextPageToken` returned by a previous list request to get the next page
283   * of results.
284   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
285   * which provides partial results in case of failure. The default value is
286   * false.
287   * @return BackendServiceList
288   */
289  public function listBackendServices($project, $optParams = [])
290  {
291    $params = ['project' => $project];
292    $params = array_merge($params, $optParams);
293    return $this->call('list', [$params], BackendServiceList::class);
294  }
295  /**
296   * Patches the specified BackendService resource with the data included in the
297   * request. For more information, see Backend services overview. This method
298   * supports PATCH semantics and uses the JSON merge patch format and processing
299   * rules. (backendServices.patch)
300   *
301   * @param string $project Project ID for this request.
302   * @param string $backendService Name of the BackendService resource to patch.
303   * @param BackendService $postBody
304   * @param array $optParams Optional parameters.
305   *
306   * @opt_param string requestId An optional request ID to identify requests.
307   * Specify a unique request ID so that if you must retry your request, the
308   * server will know to ignore the request if it has already been completed. For
309   * example, consider a situation where you make an initial request and the
310   * request times out. If you make the request again with the same request ID,
311   * the server can check if original operation with the same request ID was
312   * received, and if so, will ignore the second request. This prevents clients
313   * from accidentally creating duplicate commitments. The request ID must be a
314   * valid UUID with the exception that zero UUID is not supported (
315   * 00000000-0000-0000-0000-000000000000).
316   * @return Operation
317   */
318  public function patch($project, $backendService, BackendService $postBody, $optParams = [])
319  {
320    $params = ['project' => $project, 'backendService' => $backendService, 'postBody' => $postBody];
321    $params = array_merge($params, $optParams);
322    return $this->call('patch', [$params], Operation::class);
323  }
324  /**
325   * Sets the edge security policy for the specified backend service.
326   * (backendServices.setEdgeSecurityPolicy)
327   *
328   * @param string $project Project ID for this request.
329   * @param string $backendService Name of the BackendService resource to which
330   * the edge security policy should be set. The name should conform to RFC1035.
331   * @param SecurityPolicyReference $postBody
332   * @param array $optParams Optional parameters.
333   *
334   * @opt_param string requestId An optional request ID to identify requests.
335   * Specify a unique request ID so that if you must retry your request, the
336   * server will know to ignore the request if it has already been completed. For
337   * example, consider a situation where you make an initial request and the
338   * request times out. If you make the request again with the same request ID,
339   * the server can check if original operation with the same request ID was
340   * received, and if so, will ignore the second request. This prevents clients
341   * from accidentally creating duplicate commitments. The request ID must be a
342   * valid UUID with the exception that zero UUID is not supported (
343   * 00000000-0000-0000-0000-000000000000).
344   * @return Operation
345   */
346  public function setEdgeSecurityPolicy($project, $backendService, SecurityPolicyReference $postBody, $optParams = [])
347  {
348    $params = ['project' => $project, 'backendService' => $backendService, 'postBody' => $postBody];
349    $params = array_merge($params, $optParams);
350    return $this->call('setEdgeSecurityPolicy', [$params], Operation::class);
351  }
352  /**
353   * Sets the Google Cloud Armor security policy for the specified backend
354   * service. For more information, see Google Cloud Armor Overview
355   * (backendServices.setSecurityPolicy)
356   *
357   * @param string $project Project ID for this request.
358   * @param string $backendService Name of the BackendService resource to which
359   * the security policy should be set. The name should conform to RFC1035.
360   * @param SecurityPolicyReference $postBody
361   * @param array $optParams Optional parameters.
362   *
363   * @opt_param string requestId An optional request ID to identify requests.
364   * Specify a unique request ID so that if you must retry your request, the
365   * server will know to ignore the request if it has already been completed. For
366   * example, consider a situation where you make an initial request and the
367   * request times out. If you make the request again with the same request ID,
368   * the server can check if original operation with the same request ID was
369   * received, and if so, will ignore the second request. This prevents clients
370   * from accidentally creating duplicate commitments. The request ID must be a
371   * valid UUID with the exception that zero UUID is not supported (
372   * 00000000-0000-0000-0000-000000000000).
373   * @return Operation
374   */
375  public function setSecurityPolicy($project, $backendService, SecurityPolicyReference $postBody, $optParams = [])
376  {
377    $params = ['project' => $project, 'backendService' => $backendService, 'postBody' => $postBody];
378    $params = array_merge($params, $optParams);
379    return $this->call('setSecurityPolicy', [$params], Operation::class);
380  }
381  /**
382   * Updates the specified BackendService resource with the data included in the
383   * request. For more information, see Backend services overview.
384   * (backendServices.update)
385   *
386   * @param string $project Project ID for this request.
387   * @param string $backendService Name of the BackendService resource to update.
388   * @param BackendService $postBody
389   * @param array $optParams Optional parameters.
390   *
391   * @opt_param string requestId An optional request ID to identify requests.
392   * Specify a unique request ID so that if you must retry your request, the
393   * server will know to ignore the request if it has already been completed. For
394   * example, consider a situation where you make an initial request and the
395   * request times out. If you make the request again with the same request ID,
396   * the server can check if original operation with the same request ID was
397   * received, and if so, will ignore the second request. This prevents clients
398   * from accidentally creating duplicate commitments. The request ID must be a
399   * valid UUID with the exception that zero UUID is not supported (
400   * 00000000-0000-0000-0000-000000000000).
401   * @return Operation
402   */
403  public function update($project, $backendService, BackendService $postBody, $optParams = [])
404  {
405    $params = ['project' => $project, 'backendService' => $backendService, 'postBody' => $postBody];
406    $params = array_merge($params, $optParams);
407    return $this->call('update', [$params], Operation::class);
408  }
409}
410
411// Adding a class alias for backwards compatibility with the previous class name.
412class_alias(BackendServices::class, 'Google_Service_Compute_Resource_BackendServices');
413