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\Firewall;
21use Google\Service\Compute\FirewallList;
22use Google\Service\Compute\Operation;
23
24/**
25 * The "firewalls" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $computeService = new Google\Service\Compute(...);
29 *   $firewalls = $computeService->firewalls;
30 *  </code>
31 */
32class Firewalls extends \Google\Service\Resource
33{
34  /**
35   * Deletes the specified firewall. (firewalls.delete)
36   *
37   * @param string $project Project ID for this request.
38   * @param string $firewall Name of the firewall rule 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, $firewall, $optParams = [])
54  {
55    $params = ['project' => $project, 'firewall' => $firewall];
56    $params = array_merge($params, $optParams);
57    return $this->call('delete', [$params], Operation::class);
58  }
59  /**
60   * Returns the specified firewall. (firewalls.get)
61   *
62   * @param string $project Project ID for this request.
63   * @param string $firewall Name of the firewall rule to return.
64   * @param array $optParams Optional parameters.
65   * @return Firewall
66   */
67  public function get($project, $firewall, $optParams = [])
68  {
69    $params = ['project' => $project, 'firewall' => $firewall];
70    $params = array_merge($params, $optParams);
71    return $this->call('get', [$params], Firewall::class);
72  }
73  /**
74   * Creates a firewall rule in the specified project using the data included in
75   * the request. (firewalls.insert)
76   *
77   * @param string $project Project ID for this request.
78   * @param Firewall $postBody
79   * @param array $optParams Optional parameters.
80   *
81   * @opt_param string requestId An optional request ID to identify requests.
82   * Specify a unique request ID so that if you must retry your request, the
83   * server will know to ignore the request if it has already been completed. For
84   * example, consider a situation where you make an initial request and the
85   * request times out. If you make the request again with the same request ID,
86   * the server can check if original operation with the same request ID was
87   * received, and if so, will ignore the second request. This prevents clients
88   * from accidentally creating duplicate commitments. The request ID must be a
89   * valid UUID with the exception that zero UUID is not supported (
90   * 00000000-0000-0000-0000-000000000000).
91   * @return Operation
92   */
93  public function insert($project, Firewall $postBody, $optParams = [])
94  {
95    $params = ['project' => $project, 'postBody' => $postBody];
96    $params = array_merge($params, $optParams);
97    return $this->call('insert', [$params], Operation::class);
98  }
99  /**
100   * Retrieves the list of firewall rules available to the specified project.
101   * (firewalls.listFirewalls)
102   *
103   * @param string $project Project ID for this request.
104   * @param array $optParams Optional parameters.
105   *
106   * @opt_param string filter A filter expression that filters resources listed in
107   * the response. The expression must specify the field name, an operator, and
108   * the value that you want to use for filtering. The value must be a string, a
109   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
110   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
111   * can exclude instances named `example-instance` by specifying `name !=
112   * example-instance`. The `:` operator can be used with string fields to match
113   * substrings. For non-string fields it is equivalent to the `=` operator. The
114   * `:*` comparison can be used to test whether a key has been defined. For
115   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
116   * You can also filter nested fields. For example, you could specify
117   * `scheduling.automaticRestart = false` to include instances only if they are
118   * not scheduled for automatic restarts. You can use filtering on nested fields
119   * to filter based on resource labels. To filter on multiple expressions,
120   * provide each separate expression within parentheses. For example: ```
121   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
122   * default, each expression is an `AND` expression. However, you can include
123   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
124   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
125   * (scheduling.automaticRestart = true) ```
126   * @opt_param string maxResults The maximum number of results per page that
127   * should be returned. If the number of available results is larger than
128   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
129   * get the next page of results in subsequent list requests. Acceptable values
130   * are `0` to `500`, inclusive. (Default: `500`)
131   * @opt_param string orderBy Sorts list results by a certain order. By default,
132   * results are returned in alphanumerical order based on the resource name. You
133   * can also sort results in descending order based on the creation timestamp
134   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
135   * `creationTimestamp` field in reverse chronological order (newest result
136   * first). Use this to sort resources like operations so that the newest
137   * operation is returned first. Currently, only sorting by `name` or
138   * `creationTimestamp desc` is supported.
139   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
140   * the `nextPageToken` returned by a previous list request to get the next page
141   * of results.
142   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
143   * which provides partial results in case of failure. The default value is
144   * false.
145   * @return FirewallList
146   */
147  public function listFirewalls($project, $optParams = [])
148  {
149    $params = ['project' => $project];
150    $params = array_merge($params, $optParams);
151    return $this->call('list', [$params], FirewallList::class);
152  }
153  /**
154   * Updates the specified firewall rule with the data included in the request.
155   * This method supports PATCH semantics and uses the JSON merge patch format and
156   * processing rules. (firewalls.patch)
157   *
158   * @param string $project Project ID for this request.
159   * @param string $firewall Name of the firewall rule to patch.
160   * @param Firewall $postBody
161   * @param array $optParams Optional parameters.
162   *
163   * @opt_param string requestId An optional request ID to identify requests.
164   * Specify a unique request ID so that if you must retry your request, the
165   * server will know to ignore the request if it has already been completed. For
166   * example, consider a situation where you make an initial request and the
167   * request times out. If you make the request again with the same request ID,
168   * the server can check if original operation with the same request ID was
169   * received, and if so, will ignore the second request. This prevents clients
170   * from accidentally creating duplicate commitments. The request ID must be a
171   * valid UUID with the exception that zero UUID is not supported (
172   * 00000000-0000-0000-0000-000000000000).
173   * @return Operation
174   */
175  public function patch($project, $firewall, Firewall $postBody, $optParams = [])
176  {
177    $params = ['project' => $project, 'firewall' => $firewall, 'postBody' => $postBody];
178    $params = array_merge($params, $optParams);
179    return $this->call('patch', [$params], Operation::class);
180  }
181  /**
182   * Updates the specified firewall rule with the data included in the request.
183   * Note that all fields will be updated if using PUT, even fields that are not
184   * specified. To update individual fields, please use PATCH instead.
185   * (firewalls.update)
186   *
187   * @param string $project Project ID for this request.
188   * @param string $firewall Name of the firewall rule to update.
189   * @param Firewall $postBody
190   * @param array $optParams Optional parameters.
191   *
192   * @opt_param string requestId An optional request ID to identify requests.
193   * Specify a unique request ID so that if you must retry your request, the
194   * server will know to ignore the request if it has already been completed. For
195   * example, consider a situation where you make an initial request and the
196   * request times out. If you make the request again with the same request ID,
197   * the server can check if original operation with the same request ID was
198   * received, and if so, will ignore the second request. This prevents clients
199   * from accidentally creating duplicate commitments. The request ID must be a
200   * valid UUID with the exception that zero UUID is not supported (
201   * 00000000-0000-0000-0000-000000000000).
202   * @return Operation
203   */
204  public function update($project, $firewall, Firewall $postBody, $optParams = [])
205  {
206    $params = ['project' => $project, 'firewall' => $firewall, 'postBody' => $postBody];
207    $params = array_merge($params, $optParams);
208    return $this->call('update', [$params], Operation::class);
209  }
210}
211
212// Adding a class alias for backwards compatibility with the previous class name.
213class_alias(Firewalls::class, 'Google_Service_Compute_Resource_Firewalls');
214