[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Compute\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Compute\Region;
|
---|
| 21 | use 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 | */
|
---|
| 31 | class Regions extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Returns the specified Region resource. To decrease latency for this method,
|
---|
| 35 | * you can optionally omit any unneeded information from the response by using a
|
---|
| 36 | * field mask. This practice is especially recommended for unused quota
|
---|
| 37 | * information (the `quotas` field). To exclude one or more fields, set your
|
---|
| 38 | * request's `fields` query parameter to only include the fields you need. For
|
---|
| 39 | * example, to only include the `id` and `selfLink` fields, add the query
|
---|
| 40 | * parameter `?fields=id,selfLink` to your request. This method fails if the
|
---|
| 41 | * quota information is unavailable for the region and if the organization
|
---|
| 42 | * policy constraint compute.requireBasicQuotaInResponse is enforced. This
|
---|
| 43 | * constraint, when enforced, disables the fail-open behaviour when quota
|
---|
| 44 | * information (the `items.quotas` field) is unavailable for the region. It is
|
---|
| 45 | * recommended to use the default setting for the constraint unless your
|
---|
| 46 | * application requires the fail-closed behaviour for this method. (regions.get)
|
---|
| 47 | *
|
---|
| 48 | * @param string $project Project ID for this request.
|
---|
| 49 | * @param string $region Name of the region resource to return.
|
---|
| 50 | * @param array $optParams Optional parameters.
|
---|
| 51 | * @return Region
|
---|
| 52 | * @throws \Google\Service\Exception
|
---|
| 53 | */
|
---|
| 54 | public function get($project, $region, $optParams = [])
|
---|
| 55 | {
|
---|
| 56 | $params = ['project' => $project, 'region' => $region];
|
---|
| 57 | $params = array_merge($params, $optParams);
|
---|
| 58 | return $this->call('get', [$params], Region::class);
|
---|
| 59 | }
|
---|
| 60 | /**
|
---|
| 61 | * Retrieves the list of region resources available to the specified project. To
|
---|
| 62 | * decrease latency for this method, you can optionally omit any unneeded
|
---|
| 63 | * information from the response by using a field mask. This practice is
|
---|
| 64 | * especially recommended for unused quota information (the `items.quotas`
|
---|
| 65 | * field). To exclude one or more fields, set your request's `fields` query
|
---|
| 66 | * parameter to only include the fields you need. For example, to only include
|
---|
| 67 | * the `id` and `selfLink` fields, add the query parameter `?fields=id,selfLink`
|
---|
| 68 | * to your request. This method fails if the quota information is unavailable
|
---|
| 69 | * for the region and if the organization policy constraint
|
---|
| 70 | * compute.requireBasicQuotaInResponse is enforced. This constraint, when
|
---|
| 71 | * enforced, disables the fail-open behaviour when quota information (the
|
---|
| 72 | * `items.quotas` field) is unavailable for the region. It is recommended to use
|
---|
| 73 | * the default setting for the constraint unless your application requires the
|
---|
| 74 | * fail-closed behaviour for this method. (regions.listRegions)
|
---|
| 75 | *
|
---|
| 76 | * @param string $project Project ID for this request.
|
---|
| 77 | * @param array $optParams Optional parameters.
|
---|
| 78 | *
|
---|
| 79 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
| 80 | * the response. Most Compute resources support two types of filter expressions:
|
---|
| 81 | * expressions that support regular expressions and expressions that follow API
|
---|
| 82 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
| 83 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
| 84 | * specify the field name, an operator, and the value that you want to use for
|
---|
| 85 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
| 86 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
| 87 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
| 88 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
| 89 | * comparison can be used to test whether a key has been defined. For example,
|
---|
| 90 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
| 91 | * also filter nested fields. For example, you could specify
|
---|
| 92 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
| 93 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
| 94 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
| 95 | * provide each separate expression within parentheses. For example: ```
|
---|
| 96 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
| 97 | * default, each expression is an `AND` expression. However, you can include
|
---|
| 98 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
| 99 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
| 100 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
| 101 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
| 102 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
| 103 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
| 104 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
| 105 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
| 106 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
| 107 | * literal value must match the entire field. For example, to filter for
|
---|
| 108 | * instances that do not end with name "instance", you would use `name ne
|
---|
| 109 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
| 110 | * expressions.
|
---|
| 111 | * @opt_param string maxResults The maximum number of results per page that
|
---|
| 112 | * should be returned. If the number of available results is larger than
|
---|
| 113 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
| 114 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
| 115 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
| 116 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
| 117 | * results are returned in alphanumerical order based on the resource name. You
|
---|
| 118 | * can also sort results in descending order based on the creation timestamp
|
---|
| 119 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
| 120 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
| 121 | * first). Use this to sort resources like operations so that the newest
|
---|
| 122 | * operation is returned first. Currently, only sorting by `name` or
|
---|
| 123 | * `creationTimestamp desc` is supported.
|
---|
| 124 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
| 125 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
| 126 | * of results.
|
---|
| 127 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
| 128 | * which provides partial results in case of failure. The default value is
|
---|
| 129 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
| 130 | * for a single zone scope either returns all resources in the zone or no
|
---|
| 131 | * resources, with an error code.
|
---|
| 132 | * @return RegionList
|
---|
| 133 | * @throws \Google\Service\Exception
|
---|
| 134 | */
|
---|
| 135 | public function listRegions($project, $optParams = [])
|
---|
| 136 | {
|
---|
| 137 | $params = ['project' => $project];
|
---|
| 138 | $params = array_merge($params, $optParams);
|
---|
| 139 | return $this->call('list', [$params], RegionList::class);
|
---|
| 140 | }
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 144 | class_alias(Regions::class, 'Google_Service_Compute_Resource_Regions');
|
---|