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