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