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\Operation;
|
---|
21 | use Google\Service\Compute\RegionSetLabelsRequest;
|
---|
22 | use Google\Service\Compute\TestPermissionsRequest;
|
---|
23 | use Google\Service\Compute\TestPermissionsResponse;
|
---|
24 | use Google\Service\Compute\VpnGateway;
|
---|
25 | use Google\Service\Compute\VpnGatewayAggregatedList;
|
---|
26 | use Google\Service\Compute\VpnGatewayList;
|
---|
27 | use Google\Service\Compute\VpnGatewaysGetStatusResponse;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The "vpnGateways" collection of methods.
|
---|
31 | * Typical usage is:
|
---|
32 | * <code>
|
---|
33 | * $computeService = new Google\Service\Compute(...);
|
---|
34 | * $vpnGateways = $computeService->vpnGateways;
|
---|
35 | * </code>
|
---|
36 | */
|
---|
37 | class VpnGateways extends \Google\Service\Resource
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Retrieves an aggregated list of VPN gateways. To prevent failure, Google
|
---|
41 | * recommends that you set the `returnPartialSuccess` parameter to `true`.
|
---|
42 | * (vpnGateways.aggregatedList)
|
---|
43 | *
|
---|
44 | * @param string $project Project ID for this request.
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | *
|
---|
47 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
48 | * the response. Most Compute resources support two types of filter expressions:
|
---|
49 | * expressions that support regular expressions and expressions that follow API
|
---|
50 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
51 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
52 | * specify the field name, an operator, and the value that you want to use for
|
---|
53 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
54 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
55 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
56 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
57 | * comparison can be used to test whether a key has been defined. For example,
|
---|
58 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
59 | * also filter nested fields. For example, you could specify
|
---|
60 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
61 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
62 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
63 | * provide each separate expression within parentheses. For example: ```
|
---|
64 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
65 | * default, each expression is an `AND` expression. However, you can include
|
---|
66 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
67 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
68 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
69 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
70 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
71 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
72 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
73 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
74 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
75 | * literal value must match the entire field. For example, to filter for
|
---|
76 | * instances that do not end with name "instance", you would use `name ne
|
---|
77 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
78 | * expressions.
|
---|
79 | * @opt_param bool includeAllScopes Indicates whether every visible scope for
|
---|
80 | * each scope type (zone, region, global) should be included in the response.
|
---|
81 | * For new resource types added after this field, the flag has no effect as new
|
---|
82 | * resource types will always include every visible scope for each scope type in
|
---|
83 | * response. For resource types which predate this field, if this flag is
|
---|
84 | * omitted or false, only scopes of the scope types where the resource type is
|
---|
85 | * expected to be found will be included.
|
---|
86 | * @opt_param string maxResults The maximum number of results per page that
|
---|
87 | * should be returned. If the number of available results is larger than
|
---|
88 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
89 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
90 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
91 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
92 | * results are returned in alphanumerical order based on the resource name. You
|
---|
93 | * can also sort results in descending order based on the creation timestamp
|
---|
94 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
95 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
96 | * first). Use this to sort resources like operations so that the newest
|
---|
97 | * operation is returned first. Currently, only sorting by `name` or
|
---|
98 | * `creationTimestamp desc` is supported.
|
---|
99 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
100 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
101 | * of results.
|
---|
102 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
103 | * which provides partial results in case of failure. The default value is
|
---|
104 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
105 | * for a single zone scope either returns all resources in the zone or no
|
---|
106 | * resources, with an error code.
|
---|
107 | * @opt_param string serviceProjectNumber The Shared VPC service project id or
|
---|
108 | * service project number for which aggregated list request is invoked for
|
---|
109 | * subnetworks list-usable api.
|
---|
110 | * @return VpnGatewayAggregatedList
|
---|
111 | * @throws \Google\Service\Exception
|
---|
112 | */
|
---|
113 | public function aggregatedList($project, $optParams = [])
|
---|
114 | {
|
---|
115 | $params = ['project' => $project];
|
---|
116 | $params = array_merge($params, $optParams);
|
---|
117 | return $this->call('aggregatedList', [$params], VpnGatewayAggregatedList::class);
|
---|
118 | }
|
---|
119 | /**
|
---|
120 | * Deletes the specified VPN gateway. (vpnGateways.delete)
|
---|
121 | *
|
---|
122 | * @param string $project Project ID for this request.
|
---|
123 | * @param string $region Name of the region for this request.
|
---|
124 | * @param string $vpnGateway Name of the VPN gateway to delete.
|
---|
125 | * @param array $optParams Optional parameters.
|
---|
126 | *
|
---|
127 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
128 | * Specify a unique request ID so that if you must retry your request, the
|
---|
129 | * server will know to ignore the request if it has already been completed. For
|
---|
130 | * example, consider a situation where you make an initial request and the
|
---|
131 | * request times out. If you make the request again with the same request ID,
|
---|
132 | * the server can check if original operation with the same request ID was
|
---|
133 | * received, and if so, will ignore the second request. This prevents clients
|
---|
134 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
135 | * valid UUID with the exception that zero UUID is not supported (
|
---|
136 | * 00000000-0000-0000-0000-000000000000).
|
---|
137 | * @return Operation
|
---|
138 | * @throws \Google\Service\Exception
|
---|
139 | */
|
---|
140 | public function delete($project, $region, $vpnGateway, $optParams = [])
|
---|
141 | {
|
---|
142 | $params = ['project' => $project, 'region' => $region, 'vpnGateway' => $vpnGateway];
|
---|
143 | $params = array_merge($params, $optParams);
|
---|
144 | return $this->call('delete', [$params], Operation::class);
|
---|
145 | }
|
---|
146 | /**
|
---|
147 | * Returns the specified VPN gateway. (vpnGateways.get)
|
---|
148 | *
|
---|
149 | * @param string $project Project ID for this request.
|
---|
150 | * @param string $region Name of the region for this request.
|
---|
151 | * @param string $vpnGateway Name of the VPN gateway to return.
|
---|
152 | * @param array $optParams Optional parameters.
|
---|
153 | * @return VpnGateway
|
---|
154 | * @throws \Google\Service\Exception
|
---|
155 | */
|
---|
156 | public function get($project, $region, $vpnGateway, $optParams = [])
|
---|
157 | {
|
---|
158 | $params = ['project' => $project, 'region' => $region, 'vpnGateway' => $vpnGateway];
|
---|
159 | $params = array_merge($params, $optParams);
|
---|
160 | return $this->call('get', [$params], VpnGateway::class);
|
---|
161 | }
|
---|
162 | /**
|
---|
163 | * Returns the status for the specified VPN gateway. (vpnGateways.getStatus)
|
---|
164 | *
|
---|
165 | * @param string $project Project ID for this request.
|
---|
166 | * @param string $region Name of the region for this request.
|
---|
167 | * @param string $vpnGateway Name of the VPN gateway to return.
|
---|
168 | * @param array $optParams Optional parameters.
|
---|
169 | * @return VpnGatewaysGetStatusResponse
|
---|
170 | * @throws \Google\Service\Exception
|
---|
171 | */
|
---|
172 | public function getStatus($project, $region, $vpnGateway, $optParams = [])
|
---|
173 | {
|
---|
174 | $params = ['project' => $project, 'region' => $region, 'vpnGateway' => $vpnGateway];
|
---|
175 | $params = array_merge($params, $optParams);
|
---|
176 | return $this->call('getStatus', [$params], VpnGatewaysGetStatusResponse::class);
|
---|
177 | }
|
---|
178 | /**
|
---|
179 | * Creates a VPN gateway in the specified project and region using the data
|
---|
180 | * included in the request. (vpnGateways.insert)
|
---|
181 | *
|
---|
182 | * @param string $project Project ID for this request.
|
---|
183 | * @param string $region Name of the region for this request.
|
---|
184 | * @param VpnGateway $postBody
|
---|
185 | * @param array $optParams Optional parameters.
|
---|
186 | *
|
---|
187 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
188 | * Specify a unique request ID so that if you must retry your request, the
|
---|
189 | * server will know to ignore the request if it has already been completed. For
|
---|
190 | * example, consider a situation where you make an initial request and the
|
---|
191 | * request times out. If you make the request again with the same request ID,
|
---|
192 | * the server can check if original operation with the same request ID was
|
---|
193 | * received, and if so, will ignore the second request. This prevents clients
|
---|
194 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
195 | * valid UUID with the exception that zero UUID is not supported (
|
---|
196 | * 00000000-0000-0000-0000-000000000000).
|
---|
197 | * @return Operation
|
---|
198 | * @throws \Google\Service\Exception
|
---|
199 | */
|
---|
200 | public function insert($project, $region, VpnGateway $postBody, $optParams = [])
|
---|
201 | {
|
---|
202 | $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody];
|
---|
203 | $params = array_merge($params, $optParams);
|
---|
204 | return $this->call('insert', [$params], Operation::class);
|
---|
205 | }
|
---|
206 | /**
|
---|
207 | * Retrieves a list of VPN gateways available to the specified project and
|
---|
208 | * region. (vpnGateways.listVpnGateways)
|
---|
209 | *
|
---|
210 | * @param string $project Project ID for this request.
|
---|
211 | * @param string $region Name of the region for this request.
|
---|
212 | * @param array $optParams Optional parameters.
|
---|
213 | *
|
---|
214 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
215 | * the response. Most Compute resources support two types of filter expressions:
|
---|
216 | * expressions that support regular expressions and expressions that follow API
|
---|
217 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
218 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
219 | * specify the field name, an operator, and the value that you want to use for
|
---|
220 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
221 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
222 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
223 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
224 | * comparison can be used to test whether a key has been defined. For example,
|
---|
225 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
226 | * also filter nested fields. For example, you could specify
|
---|
227 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
228 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
229 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
230 | * provide each separate expression within parentheses. For example: ```
|
---|
231 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
232 | * default, each expression is an `AND` expression. However, you can include
|
---|
233 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
234 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
235 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
236 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
237 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
238 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
239 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
240 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
241 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
242 | * literal value must match the entire field. For example, to filter for
|
---|
243 | * instances that do not end with name "instance", you would use `name ne
|
---|
244 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
245 | * expressions.
|
---|
246 | * @opt_param string maxResults The maximum number of results per page that
|
---|
247 | * should be returned. If the number of available results is larger than
|
---|
248 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
249 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
250 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
251 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
252 | * results are returned in alphanumerical order based on the resource name. You
|
---|
253 | * can also sort results in descending order based on the creation timestamp
|
---|
254 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
255 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
256 | * first). Use this to sort resources like operations so that the newest
|
---|
257 | * operation is returned first. Currently, only sorting by `name` or
|
---|
258 | * `creationTimestamp desc` is supported.
|
---|
259 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
260 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
261 | * of results.
|
---|
262 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
263 | * which provides partial results in case of failure. The default value is
|
---|
264 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
265 | * for a single zone scope either returns all resources in the zone or no
|
---|
266 | * resources, with an error code.
|
---|
267 | * @return VpnGatewayList
|
---|
268 | * @throws \Google\Service\Exception
|
---|
269 | */
|
---|
270 | public function listVpnGateways($project, $region, $optParams = [])
|
---|
271 | {
|
---|
272 | $params = ['project' => $project, 'region' => $region];
|
---|
273 | $params = array_merge($params, $optParams);
|
---|
274 | return $this->call('list', [$params], VpnGatewayList::class);
|
---|
275 | }
|
---|
276 | /**
|
---|
277 | * Sets the labels on a VpnGateway. To learn more about labels, read the
|
---|
278 | * Labeling Resources documentation. (vpnGateways.setLabels)
|
---|
279 | *
|
---|
280 | * @param string $project Project ID for this request.
|
---|
281 | * @param string $region The region for this request.
|
---|
282 | * @param string $resource Name or id of the resource for this request.
|
---|
283 | * @param RegionSetLabelsRequest $postBody
|
---|
284 | * @param array $optParams Optional parameters.
|
---|
285 | *
|
---|
286 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
287 | * Specify a unique request ID so that if you must retry your request, the
|
---|
288 | * server will know to ignore the request if it has already been completed. For
|
---|
289 | * example, consider a situation where you make an initial request and the
|
---|
290 | * request times out. If you make the request again with the same request ID,
|
---|
291 | * the server can check if original operation with the same request ID was
|
---|
292 | * received, and if so, will ignore the second request. This prevents clients
|
---|
293 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
294 | * valid UUID with the exception that zero UUID is not supported (
|
---|
295 | * 00000000-0000-0000-0000-000000000000).
|
---|
296 | * @return Operation
|
---|
297 | * @throws \Google\Service\Exception
|
---|
298 | */
|
---|
299 | public function setLabels($project, $region, $resource, RegionSetLabelsRequest $postBody, $optParams = [])
|
---|
300 | {
|
---|
301 | $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody];
|
---|
302 | $params = array_merge($params, $optParams);
|
---|
303 | return $this->call('setLabels', [$params], Operation::class);
|
---|
304 | }
|
---|
305 | /**
|
---|
306 | * Returns permissions that a caller has on the specified resource.
|
---|
307 | * (vpnGateways.testIamPermissions)
|
---|
308 | *
|
---|
309 | * @param string $project Project ID for this request.
|
---|
310 | * @param string $region The name of the region for this request.
|
---|
311 | * @param string $resource Name or id of the resource for this request.
|
---|
312 | * @param TestPermissionsRequest $postBody
|
---|
313 | * @param array $optParams Optional parameters.
|
---|
314 | * @return TestPermissionsResponse
|
---|
315 | * @throws \Google\Service\Exception
|
---|
316 | */
|
---|
317 | public function testIamPermissions($project, $region, $resource, TestPermissionsRequest $postBody, $optParams = [])
|
---|
318 | {
|
---|
319 | $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody];
|
---|
320 | $params = array_merge($params, $optParams);
|
---|
321 | return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class);
|
---|
322 | }
|
---|
323 | }
|
---|
324 |
|
---|
325 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
326 | class_alias(VpnGateways::class, 'Google_Service_Compute_Resource_VpnGateways');
|
---|