[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\ForwardingRule;
|
---|
| 21 | use Google\Service\Compute\ForwardingRuleAggregatedList;
|
---|
| 22 | use Google\Service\Compute\ForwardingRuleList;
|
---|
| 23 | use Google\Service\Compute\Operation;
|
---|
| 24 | use Google\Service\Compute\RegionSetLabelsRequest;
|
---|
| 25 | use Google\Service\Compute\TargetReference;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "forwardingRules" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $computeService = new Google\Service\Compute(...);
|
---|
| 32 | * $forwardingRules = $computeService->forwardingRules;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class ForwardingRules extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Retrieves an aggregated list of forwarding rules. To prevent failure, Google
|
---|
| 39 | * recommends that you set the `returnPartialSuccess` parameter to `true`.
|
---|
| 40 | * (forwardingRules.aggregatedList)
|
---|
| 41 | *
|
---|
| 42 | * @param string $project Project ID for this request.
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | *
|
---|
| 45 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
| 46 | * the response. Most Compute resources support two types of filter expressions:
|
---|
| 47 | * expressions that support regular expressions and expressions that follow API
|
---|
| 48 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
| 49 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
| 50 | * specify the field name, an operator, and the value that you want to use for
|
---|
| 51 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
| 52 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
| 53 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
| 54 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
| 55 | * comparison can be used to test whether a key has been defined. For example,
|
---|
| 56 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
| 57 | * also filter nested fields. For example, you could specify
|
---|
| 58 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
| 59 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
| 60 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
| 61 | * provide each separate expression within parentheses. For example: ```
|
---|
| 62 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
| 63 | * default, each expression is an `AND` expression. However, you can include
|
---|
| 64 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
| 65 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
| 66 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
| 67 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
| 68 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
| 69 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
| 70 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
| 71 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
| 72 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
| 73 | * literal value must match the entire field. For example, to filter for
|
---|
| 74 | * instances that do not end with name "instance", you would use `name ne
|
---|
| 75 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
| 76 | * expressions.
|
---|
| 77 | * @opt_param bool includeAllScopes Indicates whether every visible scope for
|
---|
| 78 | * each scope type (zone, region, global) should be included in the response.
|
---|
| 79 | * For new resource types added after this field, the flag has no effect as new
|
---|
| 80 | * resource types will always include every visible scope for each scope type in
|
---|
| 81 | * response. For resource types which predate this field, if this flag is
|
---|
| 82 | * omitted or false, only scopes of the scope types where the resource type is
|
---|
| 83 | * expected to be found will be included.
|
---|
| 84 | * @opt_param string maxResults The maximum number of results per page that
|
---|
| 85 | * should be returned. If the number of available results is larger than
|
---|
| 86 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
| 87 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
| 88 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
| 89 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
| 90 | * results are returned in alphanumerical order based on the resource name. You
|
---|
| 91 | * can also sort results in descending order based on the creation timestamp
|
---|
| 92 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
| 93 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
| 94 | * first). Use this to sort resources like operations so that the newest
|
---|
| 95 | * operation is returned first. Currently, only sorting by `name` or
|
---|
| 96 | * `creationTimestamp desc` is supported.
|
---|
| 97 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
| 98 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
| 99 | * of results.
|
---|
| 100 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
| 101 | * which provides partial results in case of failure. The default value is
|
---|
| 102 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
| 103 | * for a single zone scope either returns all resources in the zone or no
|
---|
| 104 | * resources, with an error code.
|
---|
| 105 | * @opt_param string serviceProjectNumber The Shared VPC service project id or
|
---|
| 106 | * service project number for which aggregated list request is invoked for
|
---|
| 107 | * subnetworks list-usable api.
|
---|
| 108 | * @return ForwardingRuleAggregatedList
|
---|
| 109 | * @throws \Google\Service\Exception
|
---|
| 110 | */
|
---|
| 111 | public function aggregatedList($project, $optParams = [])
|
---|
| 112 | {
|
---|
| 113 | $params = ['project' => $project];
|
---|
| 114 | $params = array_merge($params, $optParams);
|
---|
| 115 | return $this->call('aggregatedList', [$params], ForwardingRuleAggregatedList::class);
|
---|
| 116 | }
|
---|
| 117 | /**
|
---|
| 118 | * Deletes the specified ForwardingRule resource. (forwardingRules.delete)
|
---|
| 119 | *
|
---|
| 120 | * @param string $project Project ID for this request.
|
---|
| 121 | * @param string $region Name of the region scoping this request.
|
---|
| 122 | * @param string $forwardingRule Name of the ForwardingRule resource to delete.
|
---|
| 123 | * @param array $optParams Optional parameters.
|
---|
| 124 | *
|
---|
| 125 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 126 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 127 | * server will know to ignore the request if it has already been completed. For
|
---|
| 128 | * example, consider a situation where you make an initial request and the
|
---|
| 129 | * request times out. If you make the request again with the same request ID,
|
---|
| 130 | * the server can check if original operation with the same request ID was
|
---|
| 131 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 132 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 133 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 134 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 135 | * @return Operation
|
---|
| 136 | * @throws \Google\Service\Exception
|
---|
| 137 | */
|
---|
| 138 | public function delete($project, $region, $forwardingRule, $optParams = [])
|
---|
| 139 | {
|
---|
| 140 | $params = ['project' => $project, 'region' => $region, 'forwardingRule' => $forwardingRule];
|
---|
| 141 | $params = array_merge($params, $optParams);
|
---|
| 142 | return $this->call('delete', [$params], Operation::class);
|
---|
| 143 | }
|
---|
| 144 | /**
|
---|
| 145 | * Returns the specified ForwardingRule resource. (forwardingRules.get)
|
---|
| 146 | *
|
---|
| 147 | * @param string $project Project ID for this request.
|
---|
| 148 | * @param string $region Name of the region scoping this request.
|
---|
| 149 | * @param string $forwardingRule Name of the ForwardingRule resource to return.
|
---|
| 150 | * @param array $optParams Optional parameters.
|
---|
| 151 | * @return ForwardingRule
|
---|
| 152 | * @throws \Google\Service\Exception
|
---|
| 153 | */
|
---|
| 154 | public function get($project, $region, $forwardingRule, $optParams = [])
|
---|
| 155 | {
|
---|
| 156 | $params = ['project' => $project, 'region' => $region, 'forwardingRule' => $forwardingRule];
|
---|
| 157 | $params = array_merge($params, $optParams);
|
---|
| 158 | return $this->call('get', [$params], ForwardingRule::class);
|
---|
| 159 | }
|
---|
| 160 | /**
|
---|
| 161 | * Creates a ForwardingRule resource in the specified project and region using
|
---|
| 162 | * the data included in the request. (forwardingRules.insert)
|
---|
| 163 | *
|
---|
| 164 | * @param string $project Project ID for this request.
|
---|
| 165 | * @param string $region Name of the region scoping this request.
|
---|
| 166 | * @param ForwardingRule $postBody
|
---|
| 167 | * @param array $optParams Optional parameters.
|
---|
| 168 | *
|
---|
| 169 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 170 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 171 | * server will know to ignore the request if it has already been completed. For
|
---|
| 172 | * example, consider a situation where you make an initial request and the
|
---|
| 173 | * request times out. If you make the request again with the same request ID,
|
---|
| 174 | * the server can check if original operation with the same request ID was
|
---|
| 175 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 176 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 177 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 178 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 179 | * @return Operation
|
---|
| 180 | * @throws \Google\Service\Exception
|
---|
| 181 | */
|
---|
| 182 | public function insert($project, $region, ForwardingRule $postBody, $optParams = [])
|
---|
| 183 | {
|
---|
| 184 | $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody];
|
---|
| 185 | $params = array_merge($params, $optParams);
|
---|
| 186 | return $this->call('insert', [$params], Operation::class);
|
---|
| 187 | }
|
---|
| 188 | /**
|
---|
| 189 | * Retrieves a list of ForwardingRule resources available to the specified
|
---|
| 190 | * project and region. (forwardingRules.listForwardingRules)
|
---|
| 191 | *
|
---|
| 192 | * @param string $project Project ID for this request.
|
---|
| 193 | * @param string $region Name of the region scoping this request.
|
---|
| 194 | * @param array $optParams Optional parameters.
|
---|
| 195 | *
|
---|
| 196 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
| 197 | * the response. Most Compute resources support two types of filter expressions:
|
---|
| 198 | * expressions that support regular expressions and expressions that follow API
|
---|
| 199 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
| 200 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
| 201 | * specify the field name, an operator, and the value that you want to use for
|
---|
| 202 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
| 203 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
| 204 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
| 205 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
| 206 | * comparison can be used to test whether a key has been defined. For example,
|
---|
| 207 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
| 208 | * also filter nested fields. For example, you could specify
|
---|
| 209 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
| 210 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
| 211 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
| 212 | * provide each separate expression within parentheses. For example: ```
|
---|
| 213 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
| 214 | * default, each expression is an `AND` expression. However, you can include
|
---|
| 215 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
| 216 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
| 217 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
| 218 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
| 219 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
| 220 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
| 221 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
| 222 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
| 223 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
| 224 | * literal value must match the entire field. For example, to filter for
|
---|
| 225 | * instances that do not end with name "instance", you would use `name ne
|
---|
| 226 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
| 227 | * expressions.
|
---|
| 228 | * @opt_param string maxResults The maximum number of results per page that
|
---|
| 229 | * should be returned. If the number of available results is larger than
|
---|
| 230 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
| 231 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
| 232 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
| 233 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
| 234 | * results are returned in alphanumerical order based on the resource name. You
|
---|
| 235 | * can also sort results in descending order based on the creation timestamp
|
---|
| 236 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
| 237 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
| 238 | * first). Use this to sort resources like operations so that the newest
|
---|
| 239 | * operation is returned first. Currently, only sorting by `name` or
|
---|
| 240 | * `creationTimestamp desc` is supported.
|
---|
| 241 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
| 242 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
| 243 | * of results.
|
---|
| 244 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
| 245 | * which provides partial results in case of failure. The default value is
|
---|
| 246 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
| 247 | * for a single zone scope either returns all resources in the zone or no
|
---|
| 248 | * resources, with an error code.
|
---|
| 249 | * @return ForwardingRuleList
|
---|
| 250 | * @throws \Google\Service\Exception
|
---|
| 251 | */
|
---|
| 252 | public function listForwardingRules($project, $region, $optParams = [])
|
---|
| 253 | {
|
---|
| 254 | $params = ['project' => $project, 'region' => $region];
|
---|
| 255 | $params = array_merge($params, $optParams);
|
---|
| 256 | return $this->call('list', [$params], ForwardingRuleList::class);
|
---|
| 257 | }
|
---|
| 258 | /**
|
---|
| 259 | * Updates the specified forwarding rule with the data included in the request.
|
---|
| 260 | * This method supports PATCH semantics and uses the JSON merge patch format and
|
---|
| 261 | * processing rules. Currently, you can only patch the network_tier field.
|
---|
| 262 | * (forwardingRules.patch)
|
---|
| 263 | *
|
---|
| 264 | * @param string $project Project ID for this request.
|
---|
| 265 | * @param string $region Name of the region scoping this request.
|
---|
| 266 | * @param string $forwardingRule Name of the ForwardingRule resource to patch.
|
---|
| 267 | * @param ForwardingRule $postBody
|
---|
| 268 | * @param array $optParams Optional parameters.
|
---|
| 269 | *
|
---|
| 270 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 271 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 272 | * server will know to ignore the request if it has already been completed. For
|
---|
| 273 | * example, consider a situation where you make an initial request and the
|
---|
| 274 | * request times out. If you make the request again with the same request ID,
|
---|
| 275 | * the server can check if original operation with the same request ID was
|
---|
| 276 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 277 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 278 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 279 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 280 | * @return Operation
|
---|
| 281 | * @throws \Google\Service\Exception
|
---|
| 282 | */
|
---|
| 283 | public function patch($project, $region, $forwardingRule, ForwardingRule $postBody, $optParams = [])
|
---|
| 284 | {
|
---|
| 285 | $params = ['project' => $project, 'region' => $region, 'forwardingRule' => $forwardingRule, 'postBody' => $postBody];
|
---|
| 286 | $params = array_merge($params, $optParams);
|
---|
| 287 | return $this->call('patch', [$params], Operation::class);
|
---|
| 288 | }
|
---|
| 289 | /**
|
---|
| 290 | * Sets the labels on the specified resource. To learn more about labels, read
|
---|
| 291 | * the Labeling Resources documentation. (forwardingRules.setLabels)
|
---|
| 292 | *
|
---|
| 293 | * @param string $project Project ID for this request.
|
---|
| 294 | * @param string $region The region for this request.
|
---|
| 295 | * @param string $resource Name or id of the resource for this request.
|
---|
| 296 | * @param RegionSetLabelsRequest $postBody
|
---|
| 297 | * @param array $optParams Optional parameters.
|
---|
| 298 | *
|
---|
| 299 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 300 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 301 | * server will know to ignore the request if it has already been completed. For
|
---|
| 302 | * example, consider a situation where you make an initial request and the
|
---|
| 303 | * request times out. If you make the request again with the same request ID,
|
---|
| 304 | * the server can check if original operation with the same request ID was
|
---|
| 305 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 306 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 307 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 308 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 309 | * @return Operation
|
---|
| 310 | * @throws \Google\Service\Exception
|
---|
| 311 | */
|
---|
| 312 | public function setLabels($project, $region, $resource, RegionSetLabelsRequest $postBody, $optParams = [])
|
---|
| 313 | {
|
---|
| 314 | $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody];
|
---|
| 315 | $params = array_merge($params, $optParams);
|
---|
| 316 | return $this->call('setLabels', [$params], Operation::class);
|
---|
| 317 | }
|
---|
| 318 | /**
|
---|
| 319 | * Changes target URL for forwarding rule. The new target should be of the same
|
---|
| 320 | * type as the old target. (forwardingRules.setTarget)
|
---|
| 321 | *
|
---|
| 322 | * @param string $project Project ID for this request.
|
---|
| 323 | * @param string $region Name of the region scoping this request.
|
---|
| 324 | * @param string $forwardingRule Name of the ForwardingRule resource in which
|
---|
| 325 | * target is to be set.
|
---|
| 326 | * @param TargetReference $postBody
|
---|
| 327 | * @param array $optParams Optional parameters.
|
---|
| 328 | *
|
---|
| 329 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 330 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 331 | * server will know to ignore the request if it has already been completed. For
|
---|
| 332 | * example, consider a situation where you make an initial request and the
|
---|
| 333 | * request times out. If you make the request again with the same request ID,
|
---|
| 334 | * the server can check if original operation with the same request ID was
|
---|
| 335 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 336 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 337 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 338 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 339 | * @return Operation
|
---|
| 340 | * @throws \Google\Service\Exception
|
---|
| 341 | */
|
---|
| 342 | public function setTarget($project, $region, $forwardingRule, TargetReference $postBody, $optParams = [])
|
---|
| 343 | {
|
---|
| 344 | $params = ['project' => $project, 'region' => $region, 'forwardingRule' => $forwardingRule, 'postBody' => $postBody];
|
---|
| 345 | $params = array_merge($params, $optParams);
|
---|
| 346 | return $this->call('setTarget', [$params], Operation::class);
|
---|
| 347 | }
|
---|
| 348 | }
|
---|
| 349 |
|
---|
| 350 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 351 | class_alias(ForwardingRules::class, 'Google_Service_Compute_Resource_ForwardingRules');
|
---|