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\Route;
22use Google\Service\Compute\RouteList;
23
24/**
25 * The "routes" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $computeService = new Google\Service\Compute(...);
29 *   $routes = $computeService->routes;
30 *  </code>
31 */
32class Routes extends \Google\Service\Resource
33{
34  /**
35   * Deletes the specified Route resource. (routes.delete)
36   *
37   * @param string $project Project ID for this request.
38   * @param string $route Name of the Route resource to delete.
39   * @param array $optParams Optional parameters.
40   *
41   * @opt_param string requestId An optional request ID to identify requests.
42   * Specify a unique request ID so that if you must retry your request, the
43   * server will know to ignore the request if it has already been completed. For
44   * example, consider a situation where you make an initial request and the
45   * request times out. If you make the request again with the same request ID,
46   * the server can check if original operation with the same request ID was
47   * received, and if so, will ignore the second request. This prevents clients
48   * from accidentally creating duplicate commitments. The request ID must be a
49   * valid UUID with the exception that zero UUID is not supported (
50   * 00000000-0000-0000-0000-000000000000).
51   * @return Operation
52   */
53  public function delete($project, $route, $optParams = [])
54  {
55    $params = ['project' => $project, 'route' => $route];
56    $params = array_merge($params, $optParams);
57    return $this->call('delete', [$params], Operation::class);
58  }
59  /**
60   * Returns the specified Route resource. Gets a list of available routes by
61   * making a list() request. (routes.get)
62   *
63   * @param string $project Project ID for this request.
64   * @param string $route Name of the Route resource to return.
65   * @param array $optParams Optional parameters.
66   * @return Route
67   */
68  public function get($project, $route, $optParams = [])
69  {
70    $params = ['project' => $project, 'route' => $route];
71    $params = array_merge($params, $optParams);
72    return $this->call('get', [$params], Route::class);
73  }
74  /**
75   * Creates a Route resource in the specified project using the data included in
76   * the request. (routes.insert)
77   *
78   * @param string $project Project ID for this request.
79   * @param Route $postBody
80   * @param array $optParams Optional parameters.
81   *
82   * @opt_param string requestId An optional request ID to identify requests.
83   * Specify a unique request ID so that if you must retry your request, the
84   * server will know to ignore the request if it has already been completed. For
85   * example, consider a situation where you make an initial request and the
86   * request times out. If you make the request again with the same request ID,
87   * the server can check if original operation with the same request ID was
88   * received, and if so, will ignore the second request. This prevents clients
89   * from accidentally creating duplicate commitments. The request ID must be a
90   * valid UUID with the exception that zero UUID is not supported (
91   * 00000000-0000-0000-0000-000000000000).
92   * @return Operation
93   */
94  public function insert($project, Route $postBody, $optParams = [])
95  {
96    $params = ['project' => $project, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('insert', [$params], Operation::class);
99  }
100  /**
101   * Retrieves the list of Route resources available to the specified project.
102   * (routes.listRoutes)
103   *
104   * @param string $project Project ID for this request.
105   * @param array $optParams Optional parameters.
106   *
107   * @opt_param string filter A filter expression that filters resources listed in
108   * the response. The expression must specify the field name, an operator, and
109   * the value that you want to use for filtering. The value must be a string, a
110   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
111   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
112   * can exclude instances named `example-instance` by specifying `name !=
113   * example-instance`. The `:` operator can be used with string fields to match
114   * substrings. For non-string fields it is equivalent to the `=` operator. The
115   * `:*` comparison can be used to test whether a key has been defined. For
116   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
117   * You can also filter nested fields. For example, you could specify
118   * `scheduling.automaticRestart = false` to include instances only if they are
119   * not scheduled for automatic restarts. You can use filtering on nested fields
120   * to filter based on resource labels. To filter on multiple expressions,
121   * provide each separate expression within parentheses. For example: ```
122   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
123   * default, each expression is an `AND` expression. However, you can include
124   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
125   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
126   * (scheduling.automaticRestart = true) ```
127   * @opt_param string maxResults The maximum number of results per page that
128   * should be returned. If the number of available results is larger than
129   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
130   * get the next page of results in subsequent list requests. Acceptable values
131   * are `0` to `500`, inclusive. (Default: `500`)
132   * @opt_param string orderBy Sorts list results by a certain order. By default,
133   * results are returned in alphanumerical order based on the resource name. You
134   * can also sort results in descending order based on the creation timestamp
135   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
136   * `creationTimestamp` field in reverse chronological order (newest result
137   * first). Use this to sort resources like operations so that the newest
138   * operation is returned first. Currently, only sorting by `name` or
139   * `creationTimestamp desc` is supported.
140   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
141   * the `nextPageToken` returned by a previous list request to get the next page
142   * of results.
143   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
144   * which provides partial results in case of failure. The default value is
145   * false.
146   * @return RouteList
147   */
148  public function listRoutes($project, $optParams = [])
149  {
150    $params = ['project' => $project];
151    $params = array_merge($params, $optParams);
152    return $this->call('list', [$params], RouteList::class);
153  }
154}
155
156// Adding a class alias for backwards compatibility with the previous class name.
157class_alias(Routes::class, 'Google_Service_Compute_Resource_Routes');
158