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\NetworkEndpointGroup;
21use Google\Service\Compute\NetworkEndpointGroupAggregatedList;
22use Google\Service\Compute\NetworkEndpointGroupList;
23use Google\Service\Compute\NetworkEndpointGroupsAttachEndpointsRequest;
24use Google\Service\Compute\NetworkEndpointGroupsDetachEndpointsRequest;
25use Google\Service\Compute\NetworkEndpointGroupsListEndpointsRequest;
26use Google\Service\Compute\NetworkEndpointGroupsListNetworkEndpoints;
27use Google\Service\Compute\Operation;
28use Google\Service\Compute\TestPermissionsRequest;
29use Google\Service\Compute\TestPermissionsResponse;
30
31/**
32 * The "networkEndpointGroups" collection of methods.
33 * Typical usage is:
34 *  <code>
35 *   $computeService = new Google\Service\Compute(...);
36 *   $networkEndpointGroups = $computeService->networkEndpointGroups;
37 *  </code>
38 */
39class NetworkEndpointGroups extends \Google\Service\Resource
40{
41  /**
42   * Retrieves the list of network endpoint groups and sorts them by zone.
43   * (networkEndpointGroups.aggregatedList)
44   *
45   * @param string $project Project ID for this request.
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string filter A filter expression that filters resources listed in
49   * the response. The expression must specify the field name, an operator, and
50   * the value that you want to use for filtering. The value must be a string, a
51   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
52   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
53   * can exclude instances named `example-instance` by specifying `name !=
54   * example-instance`. The `:` operator can be used with string fields to match
55   * substrings. For non-string fields it is equivalent to the `=` operator. The
56   * `:*` comparison can be used to test whether a key has been defined. For
57   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
58   * You can also filter nested fields. For example, you could specify
59   * `scheduling.automaticRestart = false` to include instances only if they are
60   * not scheduled for automatic restarts. You can use filtering on nested fields
61   * to filter based on resource labels. To filter on multiple expressions,
62   * provide each separate expression within parentheses. For example: ```
63   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
64   * default, each expression is an `AND` expression. However, you can include
65   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
66   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
67   * (scheduling.automaticRestart = true) ```
68   * @opt_param bool includeAllScopes Indicates whether every visible scope for
69   * each scope type (zone, region, global) should be included in the response.
70   * For new resource types added after this field, the flag has no effect as new
71   * resource types will always include every visible scope for each scope type in
72   * response. For resource types which predate this field, if this flag is
73   * omitted or false, only scopes of the scope types where the resource type is
74   * expected to be found will be included.
75   * @opt_param string maxResults The maximum number of results per page that
76   * should be returned. If the number of available results is larger than
77   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
78   * get the next page of results in subsequent list requests. Acceptable values
79   * are `0` to `500`, inclusive. (Default: `500`)
80   * @opt_param string orderBy Sorts list results by a certain order. By default,
81   * results are returned in alphanumerical order based on the resource name. You
82   * can also sort results in descending order based on the creation timestamp
83   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
84   * `creationTimestamp` field in reverse chronological order (newest result
85   * first). Use this to sort resources like operations so that the newest
86   * operation is returned first. Currently, only sorting by `name` or
87   * `creationTimestamp desc` is supported.
88   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
89   * the `nextPageToken` returned by a previous list request to get the next page
90   * of results.
91   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
92   * which provides partial results in case of failure. The default value is
93   * false.
94   * @return NetworkEndpointGroupAggregatedList
95   */
96  public function aggregatedList($project, $optParams = [])
97  {
98    $params = ['project' => $project];
99    $params = array_merge($params, $optParams);
100    return $this->call('aggregatedList', [$params], NetworkEndpointGroupAggregatedList::class);
101  }
102  /**
103   * Attach a list of network endpoints to the specified network endpoint group.
104   * (networkEndpointGroups.attachNetworkEndpoints)
105   *
106   * @param string $project Project ID for this request.
107   * @param string $zone The name of the zone where the network endpoint group is
108   * located. It should comply with RFC1035.
109   * @param string $networkEndpointGroup The name of the network endpoint group
110   * where you are attaching network endpoints to. It should comply with RFC1035.
111   * @param NetworkEndpointGroupsAttachEndpointsRequest $postBody
112   * @param array $optParams Optional parameters.
113   *
114   * @opt_param string requestId An optional request ID to identify requests.
115   * Specify a unique request ID so that if you must retry your request, the
116   * server will know to ignore the request if it has already been completed. For
117   * example, consider a situation where you make an initial request and the
118   * request times out. If you make the request again with the same request ID,
119   * the server can check if original operation with the same request ID was
120   * received, and if so, will ignore the second request. This prevents clients
121   * from accidentally creating duplicate commitments. The request ID must be a
122   * valid UUID with the exception that zero UUID is not supported (
123   * 00000000-0000-0000-0000-000000000000).
124   * @return Operation
125   */
126  public function attachNetworkEndpoints($project, $zone, $networkEndpointGroup, NetworkEndpointGroupsAttachEndpointsRequest $postBody, $optParams = [])
127  {
128    $params = ['project' => $project, 'zone' => $zone, 'networkEndpointGroup' => $networkEndpointGroup, 'postBody' => $postBody];
129    $params = array_merge($params, $optParams);
130    return $this->call('attachNetworkEndpoints', [$params], Operation::class);
131  }
132  /**
133   * Deletes the specified network endpoint group. The network endpoints in the
134   * NEG and the VM instances they belong to are not terminated when the NEG is
135   * deleted. Note that the NEG cannot be deleted if there are backend services
136   * referencing it. (networkEndpointGroups.delete)
137   *
138   * @param string $project Project ID for this request.
139   * @param string $zone The name of the zone where the network endpoint group is
140   * located. It should comply with RFC1035.
141   * @param string $networkEndpointGroup The name of the network endpoint group to
142   * delete. It should comply with RFC1035.
143   * @param array $optParams Optional parameters.
144   *
145   * @opt_param string requestId An optional request ID to identify requests.
146   * Specify a unique request ID so that if you must retry your request, the
147   * server will know to ignore the request if it has already been completed. For
148   * example, consider a situation where you make an initial request and the
149   * request times out. If you make the request again with the same request ID,
150   * the server can check if original operation with the same request ID was
151   * received, and if so, will ignore the second request. This prevents clients
152   * from accidentally creating duplicate commitments. The request ID must be a
153   * valid UUID with the exception that zero UUID is not supported (
154   * 00000000-0000-0000-0000-000000000000).
155   * @return Operation
156   */
157  public function delete($project, $zone, $networkEndpointGroup, $optParams = [])
158  {
159    $params = ['project' => $project, 'zone' => $zone, 'networkEndpointGroup' => $networkEndpointGroup];
160    $params = array_merge($params, $optParams);
161    return $this->call('delete', [$params], Operation::class);
162  }
163  /**
164   * Detach a list of network endpoints from the specified network endpoint group.
165   * (networkEndpointGroups.detachNetworkEndpoints)
166   *
167   * @param string $project Project ID for this request.
168   * @param string $zone The name of the zone where the network endpoint group is
169   * located. It should comply with RFC1035.
170   * @param string $networkEndpointGroup The name of the network endpoint group
171   * where you are removing network endpoints. It should comply with RFC1035.
172   * @param NetworkEndpointGroupsDetachEndpointsRequest $postBody
173   * @param array $optParams Optional parameters.
174   *
175   * @opt_param string requestId An optional request ID to identify requests.
176   * Specify a unique request ID so that if you must retry your request, the
177   * server will know to ignore the request if it has already been completed. For
178   * example, consider a situation where you make an initial request and the
179   * request times out. If you make the request again with the same request ID,
180   * the server can check if original operation with the same request ID was
181   * received, and if so, will ignore the second request. This prevents clients
182   * from accidentally creating duplicate commitments. The request ID must be a
183   * valid UUID with the exception that zero UUID is not supported (
184   * 00000000-0000-0000-0000-000000000000).
185   * @return Operation
186   */
187  public function detachNetworkEndpoints($project, $zone, $networkEndpointGroup, NetworkEndpointGroupsDetachEndpointsRequest $postBody, $optParams = [])
188  {
189    $params = ['project' => $project, 'zone' => $zone, 'networkEndpointGroup' => $networkEndpointGroup, 'postBody' => $postBody];
190    $params = array_merge($params, $optParams);
191    return $this->call('detachNetworkEndpoints', [$params], Operation::class);
192  }
193  /**
194   * Returns the specified network endpoint group. Gets a list of available
195   * network endpoint groups by making a list() request.
196   * (networkEndpointGroups.get)
197   *
198   * @param string $project Project ID for this request.
199   * @param string $zone The name of the zone where the network endpoint group is
200   * located. It should comply with RFC1035.
201   * @param string $networkEndpointGroup The name of the network endpoint group.
202   * It should comply with RFC1035.
203   * @param array $optParams Optional parameters.
204   * @return NetworkEndpointGroup
205   */
206  public function get($project, $zone, $networkEndpointGroup, $optParams = [])
207  {
208    $params = ['project' => $project, 'zone' => $zone, 'networkEndpointGroup' => $networkEndpointGroup];
209    $params = array_merge($params, $optParams);
210    return $this->call('get', [$params], NetworkEndpointGroup::class);
211  }
212  /**
213   * Creates a network endpoint group in the specified project using the
214   * parameters that are included in the request. (networkEndpointGroups.insert)
215   *
216   * @param string $project Project ID for this request.
217   * @param string $zone The name of the zone where you want to create the network
218   * endpoint group. It should comply with RFC1035.
219   * @param NetworkEndpointGroup $postBody
220   * @param array $optParams Optional parameters.
221   *
222   * @opt_param string requestId An optional request ID to identify requests.
223   * Specify a unique request ID so that if you must retry your request, the
224   * server will know to ignore the request if it has already been completed. For
225   * example, consider a situation where you make an initial request and the
226   * request times out. If you make the request again with the same request ID,
227   * the server can check if original operation with the same request ID was
228   * received, and if so, will ignore the second request. This prevents clients
229   * from accidentally creating duplicate commitments. The request ID must be a
230   * valid UUID with the exception that zero UUID is not supported (
231   * 00000000-0000-0000-0000-000000000000).
232   * @return Operation
233   */
234  public function insert($project, $zone, NetworkEndpointGroup $postBody, $optParams = [])
235  {
236    $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody];
237    $params = array_merge($params, $optParams);
238    return $this->call('insert', [$params], Operation::class);
239  }
240  /**
241   * Retrieves the list of network endpoint groups that are located in the
242   * specified project and zone. (networkEndpointGroups.listNetworkEndpointGroups)
243   *
244   * @param string $project Project ID for this request.
245   * @param string $zone The name of the zone where the network endpoint group is
246   * located. It should comply with RFC1035.
247   * @param array $optParams Optional parameters.
248   *
249   * @opt_param string filter A filter expression that filters resources listed in
250   * the response. The expression must specify the field name, an operator, and
251   * the value that you want to use for filtering. The value must be a string, a
252   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
253   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
254   * can exclude instances named `example-instance` by specifying `name !=
255   * example-instance`. The `:` operator can be used with string fields to match
256   * substrings. For non-string fields it is equivalent to the `=` operator. The
257   * `:*` comparison can be used to test whether a key has been defined. For
258   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
259   * You can also filter nested fields. For example, you could specify
260   * `scheduling.automaticRestart = false` to include instances only if they are
261   * not scheduled for automatic restarts. You can use filtering on nested fields
262   * to filter based on resource labels. To filter on multiple expressions,
263   * provide each separate expression within parentheses. For example: ```
264   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
265   * default, each expression is an `AND` expression. However, you can include
266   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
267   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
268   * (scheduling.automaticRestart = true) ```
269   * @opt_param string maxResults The maximum number of results per page that
270   * should be returned. If the number of available results is larger than
271   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
272   * get the next page of results in subsequent list requests. Acceptable values
273   * are `0` to `500`, inclusive. (Default: `500`)
274   * @opt_param string orderBy Sorts list results by a certain order. By default,
275   * results are returned in alphanumerical order based on the resource name. You
276   * can also sort results in descending order based on the creation timestamp
277   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
278   * `creationTimestamp` field in reverse chronological order (newest result
279   * first). Use this to sort resources like operations so that the newest
280   * operation is returned first. Currently, only sorting by `name` or
281   * `creationTimestamp desc` is supported.
282   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
283   * the `nextPageToken` returned by a previous list request to get the next page
284   * of results.
285   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
286   * which provides partial results in case of failure. The default value is
287   * false.
288   * @return NetworkEndpointGroupList
289   */
290  public function listNetworkEndpointGroups($project, $zone, $optParams = [])
291  {
292    $params = ['project' => $project, 'zone' => $zone];
293    $params = array_merge($params, $optParams);
294    return $this->call('list', [$params], NetworkEndpointGroupList::class);
295  }
296  /**
297   * Lists the network endpoints in the specified network endpoint group.
298   * (networkEndpointGroups.listNetworkEndpoints)
299   *
300   * @param string $project Project ID for this request.
301   * @param string $zone The name of the zone where the network endpoint group is
302   * located. It should comply with RFC1035.
303   * @param string $networkEndpointGroup The name of the network endpoint group
304   * from which you want to generate a list of included network endpoints. It
305   * should comply with RFC1035.
306   * @param NetworkEndpointGroupsListEndpointsRequest $postBody
307   * @param array $optParams Optional parameters.
308   *
309   * @opt_param string filter A filter expression that filters resources listed in
310   * the response. The expression must specify the field name, an operator, and
311   * the value that you want to use for filtering. The value must be a string, a
312   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
313   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
314   * can exclude instances named `example-instance` by specifying `name !=
315   * example-instance`. The `:` operator can be used with string fields to match
316   * substrings. For non-string fields it is equivalent to the `=` operator. The
317   * `:*` comparison can be used to test whether a key has been defined. For
318   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
319   * You can also filter nested fields. For example, you could specify
320   * `scheduling.automaticRestart = false` to include instances only if they are
321   * not scheduled for automatic restarts. You can use filtering on nested fields
322   * to filter based on resource labels. To filter on multiple expressions,
323   * provide each separate expression within parentheses. For example: ```
324   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
325   * default, each expression is an `AND` expression. However, you can include
326   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
327   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
328   * (scheduling.automaticRestart = true) ```
329   * @opt_param string maxResults The maximum number of results per page that
330   * should be returned. If the number of available results is larger than
331   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
332   * get the next page of results in subsequent list requests. Acceptable values
333   * are `0` to `500`, inclusive. (Default: `500`)
334   * @opt_param string orderBy Sorts list results by a certain order. By default,
335   * results are returned in alphanumerical order based on the resource name. You
336   * can also sort results in descending order based on the creation timestamp
337   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
338   * `creationTimestamp` field in reverse chronological order (newest result
339   * first). Use this to sort resources like operations so that the newest
340   * operation is returned first. Currently, only sorting by `name` or
341   * `creationTimestamp desc` is supported.
342   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
343   * the `nextPageToken` returned by a previous list request to get the next page
344   * of results.
345   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
346   * which provides partial results in case of failure. The default value is
347   * false.
348   * @return NetworkEndpointGroupsListNetworkEndpoints
349   */
350  public function listNetworkEndpoints($project, $zone, $networkEndpointGroup, NetworkEndpointGroupsListEndpointsRequest $postBody, $optParams = [])
351  {
352    $params = ['project' => $project, 'zone' => $zone, 'networkEndpointGroup' => $networkEndpointGroup, 'postBody' => $postBody];
353    $params = array_merge($params, $optParams);
354    return $this->call('listNetworkEndpoints', [$params], NetworkEndpointGroupsListNetworkEndpoints::class);
355  }
356  /**
357   * Returns permissions that a caller has on the specified resource.
358   * (networkEndpointGroups.testIamPermissions)
359   *
360   * @param string $project Project ID for this request.
361   * @param string $zone The name of the zone for this request.
362   * @param string $resource Name or id of the resource for this request.
363   * @param TestPermissionsRequest $postBody
364   * @param array $optParams Optional parameters.
365   * @return TestPermissionsResponse
366   */
367  public function testIamPermissions($project, $zone, $resource, TestPermissionsRequest $postBody, $optParams = [])
368  {
369    $params = ['project' => $project, 'zone' => $zone, 'resource' => $resource, 'postBody' => $postBody];
370    $params = array_merge($params, $optParams);
371    return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class);
372  }
373}
374
375// Adding a class alias for backwards compatibility with the previous class name.
376class_alias(NetworkEndpointGroups::class, 'Google_Service_Compute_Resource_NetworkEndpointGroups');
377