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