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\Operation;
21use Google\Service\Compute\Router;
22use Google\Service\Compute\RouterAggregatedList;
23use Google\Service\Compute\RouterList;
24use Google\Service\Compute\RouterStatusResponse;
25use Google\Service\Compute\RoutersPreviewResponse;
26use Google\Service\Compute\VmEndpointNatMappingsList;
27
28/**
29 * The "routers" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $computeService = new Google\Service\Compute(...);
33 *   $routers = $computeService->routers;
34 *  </code>
35 */
36class Routers extends \Google\Service\Resource
37{
38  /**
39   * Retrieves an aggregated list of routers. (routers.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 RouterAggregatedList
91   */
92  public function aggregatedList($project, $optParams = [])
93  {
94    $params = ['project' => $project];
95    $params = array_merge($params, $optParams);
96    return $this->call('aggregatedList', [$params], RouterAggregatedList::class);
97  }
98  /**
99   * Deletes the specified Router resource. (routers.delete)
100   *
101   * @param string $project Project ID for this request.
102   * @param string $region Name of the region for this request.
103   * @param string $router Name of the Router 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, $router, $optParams = [])
119  {
120    $params = ['project' => $project, 'region' => $region, 'router' => $router];
121    $params = array_merge($params, $optParams);
122    return $this->call('delete', [$params], Operation::class);
123  }
124  /**
125   * Returns the specified Router resource. Gets a list of available routers by
126   * making a list() request. (routers.get)
127   *
128   * @param string $project Project ID for this request.
129   * @param string $region Name of the region for this request.
130   * @param string $router Name of the Router resource to return.
131   * @param array $optParams Optional parameters.
132   * @return Router
133   */
134  public function get($project, $region, $router, $optParams = [])
135  {
136    $params = ['project' => $project, 'region' => $region, 'router' => $router];
137    $params = array_merge($params, $optParams);
138    return $this->call('get', [$params], Router::class);
139  }
140  /**
141   * Retrieves runtime Nat mapping information of VM endpoints.
142   * (routers.getNatMappingInfo)
143   *
144   * @param string $project Project ID for this request.
145   * @param string $region Name of the region for this request.
146   * @param string $router Name of the Router resource to query for Nat Mapping
147   * information of VM endpoints.
148   * @param array $optParams Optional parameters.
149   *
150   * @opt_param string filter A filter expression that filters resources listed in
151   * the response. The expression must specify the field name, an operator, and
152   * the value that you want to use for filtering. The value must be a string, a
153   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
154   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
155   * can exclude instances named `example-instance` by specifying `name !=
156   * example-instance`. The `:` operator can be used with string fields to match
157   * substrings. For non-string fields it is equivalent to the `=` operator. The
158   * `:*` comparison can be used to test whether a key has been defined. For
159   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
160   * You can also filter nested fields. For example, you could specify
161   * `scheduling.automaticRestart = false` to include instances only if they are
162   * not scheduled for automatic restarts. You can use filtering on nested fields
163   * to filter based on resource labels. To filter on multiple expressions,
164   * provide each separate expression within parentheses. For example: ```
165   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
166   * default, each expression is an `AND` expression. However, you can include
167   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
168   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
169   * (scheduling.automaticRestart = true) ```
170   * @opt_param string maxResults The maximum number of results per page that
171   * should be returned. If the number of available results is larger than
172   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
173   * get the next page of results in subsequent list requests. Acceptable values
174   * are `0` to `500`, inclusive. (Default: `500`)
175   * @opt_param string orderBy Sorts list results by a certain order. By default,
176   * results are returned in alphanumerical order based on the resource name. You
177   * can also sort results in descending order based on the creation timestamp
178   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
179   * `creationTimestamp` field in reverse chronological order (newest result
180   * first). Use this to sort resources like operations so that the newest
181   * operation is returned first. Currently, only sorting by `name` or
182   * `creationTimestamp desc` is supported.
183   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
184   * the `nextPageToken` returned by a previous list request to get the next page
185   * of results.
186   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
187   * which provides partial results in case of failure. The default value is
188   * false.
189   * @return VmEndpointNatMappingsList
190   */
191  public function getNatMappingInfo($project, $region, $router, $optParams = [])
192  {
193    $params = ['project' => $project, 'region' => $region, 'router' => $router];
194    $params = array_merge($params, $optParams);
195    return $this->call('getNatMappingInfo', [$params], VmEndpointNatMappingsList::class);
196  }
197  /**
198   * Retrieves runtime information of the specified router.
199   * (routers.getRouterStatus)
200   *
201   * @param string $project Project ID for this request.
202   * @param string $region Name of the region for this request.
203   * @param string $router Name of the Router resource to query.
204   * @param array $optParams Optional parameters.
205   * @return RouterStatusResponse
206   */
207  public function getRouterStatus($project, $region, $router, $optParams = [])
208  {
209    $params = ['project' => $project, 'region' => $region, 'router' => $router];
210    $params = array_merge($params, $optParams);
211    return $this->call('getRouterStatus', [$params], RouterStatusResponse::class);
212  }
213  /**
214   * Creates a Router resource in the specified project and region using the data
215   * included in the request. (routers.insert)
216   *
217   * @param string $project Project ID for this request.
218   * @param string $region Name of the region for this request.
219   * @param Router $postBody
220   * @param array $optParams Optional parameters.
221   *
222   * @opt_param string requestId An optional request ID to identify requests.
223   * Specify a unique request ID so that if you must retry your request, the
224   * server will know to ignore the request if it has already been completed. For
225   * example, consider a situation where you make an initial request and the
226   * request times out. If you make the request again with the same request ID,
227   * the server can check if original operation with the same request ID was
228   * received, and if so, will ignore the second request. This prevents clients
229   * from accidentally creating duplicate commitments. The request ID must be a
230   * valid UUID with the exception that zero UUID is not supported (
231   * 00000000-0000-0000-0000-000000000000).
232   * @return Operation
233   */
234  public function insert($project, $region, Router $postBody, $optParams = [])
235  {
236    $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody];
237    $params = array_merge($params, $optParams);
238    return $this->call('insert', [$params], Operation::class);
239  }
240  /**
241   * Retrieves a list of Router resources available to the specified project.
242   * (routers.listRouters)
243   *
244   * @param string $project Project ID for this request.
245   * @param string $region Name of the region for this request.
246   * @param array $optParams Optional parameters.
247   *
248   * @opt_param string filter A filter expression that filters resources listed in
249   * the response. The expression must specify the field name, an operator, and
250   * the value that you want to use for filtering. The value must be a string, a
251   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
252   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
253   * can exclude instances named `example-instance` by specifying `name !=
254   * example-instance`. The `:` operator can be used with string fields to match
255   * substrings. For non-string fields it is equivalent to the `=` operator. The
256   * `:*` comparison can be used to test whether a key has been defined. For
257   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
258   * You can also filter nested fields. For example, you could specify
259   * `scheduling.automaticRestart = false` to include instances only if they are
260   * not scheduled for automatic restarts. You can use filtering on nested fields
261   * to filter based on resource labels. To filter on multiple expressions,
262   * provide each separate expression within parentheses. For example: ```
263   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
264   * default, each expression is an `AND` expression. However, you can include
265   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
266   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
267   * (scheduling.automaticRestart = true) ```
268   * @opt_param string maxResults The maximum number of results per page that
269   * should be returned. If the number of available results is larger than
270   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
271   * get the next page of results in subsequent list requests. Acceptable values
272   * are `0` to `500`, inclusive. (Default: `500`)
273   * @opt_param string orderBy Sorts list results by a certain order. By default,
274   * results are returned in alphanumerical order based on the resource name. You
275   * can also sort results in descending order based on the creation timestamp
276   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
277   * `creationTimestamp` field in reverse chronological order (newest result
278   * first). Use this to sort resources like operations so that the newest
279   * operation is returned first. Currently, only sorting by `name` or
280   * `creationTimestamp desc` is supported.
281   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
282   * the `nextPageToken` returned by a previous list request to get the next page
283   * of results.
284   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
285   * which provides partial results in case of failure. The default value is
286   * false.
287   * @return RouterList
288   */
289  public function listRouters($project, $region, $optParams = [])
290  {
291    $params = ['project' => $project, 'region' => $region];
292    $params = array_merge($params, $optParams);
293    return $this->call('list', [$params], RouterList::class);
294  }
295  /**
296   * Patches the specified Router resource with the data included in the request.
297   * This method supports PATCH semantics and uses JSON merge patch format and
298   * processing rules. (routers.patch)
299   *
300   * @param string $project Project ID for this request.
301   * @param string $region Name of the region for this request.
302   * @param string $router Name of the Router resource to patch.
303   * @param Router $postBody
304   * @param array $optParams Optional parameters.
305   *
306   * @opt_param string requestId An optional request ID to identify requests.
307   * Specify a unique request ID so that if you must retry your request, the
308   * server will know to ignore the request if it has already been completed. For
309   * example, consider a situation where you make an initial request and the
310   * request times out. If you make the request again with the same request ID,
311   * the server can check if original operation with the same request ID was
312   * received, and if so, will ignore the second request. This prevents clients
313   * from accidentally creating duplicate commitments. The request ID must be a
314   * valid UUID with the exception that zero UUID is not supported (
315   * 00000000-0000-0000-0000-000000000000).
316   * @return Operation
317   */
318  public function patch($project, $region, $router, Router $postBody, $optParams = [])
319  {
320    $params = ['project' => $project, 'region' => $region, 'router' => $router, 'postBody' => $postBody];
321    $params = array_merge($params, $optParams);
322    return $this->call('patch', [$params], Operation::class);
323  }
324  /**
325   * Preview fields auto-generated during router create and update operations.
326   * Calling this method does NOT create or update the router. (routers.preview)
327   *
328   * @param string $project Project ID for this request.
329   * @param string $region Name of the region for this request.
330   * @param string $router Name of the Router resource to query.
331   * @param Router $postBody
332   * @param array $optParams Optional parameters.
333   * @return RoutersPreviewResponse
334   */
335  public function preview($project, $region, $router, Router $postBody, $optParams = [])
336  {
337    $params = ['project' => $project, 'region' => $region, 'router' => $router, 'postBody' => $postBody];
338    $params = array_merge($params, $optParams);
339    return $this->call('preview', [$params], RoutersPreviewResponse::class);
340  }
341  /**
342   * Updates the specified Router resource with the data included in the request.
343   * This method conforms to PUT semantics, which requests that the state of the
344   * target resource be created or replaced with the state defined by the
345   * representation enclosed in the request message payload. (routers.update)
346   *
347   * @param string $project Project ID for this request.
348   * @param string $region Name of the region for this request.
349   * @param string $router Name of the Router resource to update.
350   * @param Router $postBody
351   * @param array $optParams Optional parameters.
352   *
353   * @opt_param string requestId An optional request ID to identify requests.
354   * Specify a unique request ID so that if you must retry your request, the
355   * server will know to ignore the request if it has already been completed. For
356   * example, consider a situation where you make an initial request and the
357   * request times out. If you make the request again with the same request ID,
358   * the server can check if original operation with the same request ID was
359   * received, and if so, will ignore the second request. This prevents clients
360   * from accidentally creating duplicate commitments. The request ID must be a
361   * valid UUID with the exception that zero UUID is not supported (
362   * 00000000-0000-0000-0000-000000000000).
363   * @return Operation
364   */
365  public function update($project, $region, $router, Router $postBody, $optParams = [])
366  {
367    $params = ['project' => $project, 'region' => $region, 'router' => $router, 'postBody' => $postBody];
368    $params = array_merge($params, $optParams);
369    return $this->call('update', [$params], Operation::class);
370  }
371}
372
373// Adding a class alias for backwards compatibility with the previous class name.
374class_alias(Routers::class, 'Google_Service_Compute_Resource_Routers');
375