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\Zone;
21use Google\Service\Compute\ZoneList;
22
23/**
24 * The "zones" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $computeService = new Google\Service\Compute(...);
28 *   $zones = $computeService->zones;
29 *  </code>
30 */
31class Zones extends \Google\Service\Resource
32{
33  /**
34   * Returns the specified Zone resource. Gets a list of available zones by making
35   * a list() request. (zones.get)
36   *
37   * @param string $project Project ID for this request.
38   * @param string $zone Name of the zone resource to return.
39   * @param array $optParams Optional parameters.
40   * @return Zone
41   */
42  public function get($project, $zone, $optParams = [])
43  {
44    $params = ['project' => $project, 'zone' => $zone];
45    $params = array_merge($params, $optParams);
46    return $this->call('get', [$params], Zone::class);
47  }
48  /**
49   * Retrieves the list of Zone resources available to the specified project.
50   * (zones.listZones)
51   *
52   * @param string $project Project ID for this request.
53   * @param array $optParams Optional parameters.
54   *
55   * @opt_param string filter A filter expression that filters resources listed in
56   * the response. The expression must specify the field name, an operator, and
57   * the value that you want to use for filtering. The value must be a string, a
58   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
59   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
60   * can exclude instances named `example-instance` by specifying `name !=
61   * example-instance`. The `:` operator can be used with string fields to match
62   * substrings. For non-string fields it is equivalent to the `=` operator. The
63   * `:*` comparison can be used to test whether a key has been defined. For
64   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
65   * You can also filter nested fields. For example, you could specify
66   * `scheduling.automaticRestart = false` to include instances only if they are
67   * not scheduled for automatic restarts. You can use filtering on nested fields
68   * to filter based on resource labels. To filter on multiple expressions,
69   * provide each separate expression within parentheses. For example: ```
70   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
71   * default, each expression is an `AND` expression. However, you can include
72   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
73   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
74   * (scheduling.automaticRestart = true) ```
75   * @opt_param string maxResults The maximum number of results per page that
76   * should be returned. If the number of available results is larger than
77   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
78   * get the next page of results in subsequent list requests. Acceptable values
79   * are `0` to `500`, inclusive. (Default: `500`)
80   * @opt_param string orderBy Sorts list results by a certain order. By default,
81   * results are returned in alphanumerical order based on the resource name. You
82   * can also sort results in descending order based on the creation timestamp
83   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
84   * `creationTimestamp` field in reverse chronological order (newest result
85   * first). Use this to sort resources like operations so that the newest
86   * operation is returned first. Currently, only sorting by `name` or
87   * `creationTimestamp desc` is supported.
88   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
89   * the `nextPageToken` returned by a previous list request to get the next page
90   * of results.
91   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
92   * which provides partial results in case of failure. The default value is
93   * false.
94   * @return ZoneList
95   */
96  public function listZones($project, $optParams = [])
97  {
98    $params = ['project' => $project];
99    $params = array_merge($params, $optParams);
100    return $this->call('list', [$params], ZoneList::class);
101  }
102}
103
104// Adding a class alias for backwards compatibility with the previous class name.
105class_alias(Zones::class, 'Google_Service_Compute_Resource_Zones');
106