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