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\GlobalNetworkEndpointGroupsAttachEndpointsRequest;
21use Google\Service\Compute\GlobalNetworkEndpointGroupsDetachEndpointsRequest;
22use Google\Service\Compute\NetworkEndpointGroup;
23use Google\Service\Compute\NetworkEndpointGroupList;
24use Google\Service\Compute\NetworkEndpointGroupsListNetworkEndpoints;
25use Google\Service\Compute\Operation;
26
27/**
28 * The "globalNetworkEndpointGroups" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $computeService = new Google\Service\Compute(...);
32 *   $globalNetworkEndpointGroups = $computeService->globalNetworkEndpointGroups;
33 *  </code>
34 */
35class GlobalNetworkEndpointGroups extends \Google\Service\Resource
36{
37  /**
38   * Attach a network endpoint to the specified network endpoint group.
39   * (globalNetworkEndpointGroups.attachNetworkEndpoints)
40   *
41   * @param string $project Project ID for this request.
42   * @param string $networkEndpointGroup The name of the network endpoint group
43   * where you are attaching network endpoints to. It should comply with RFC1035.
44   * @param GlobalNetworkEndpointGroupsAttachEndpointsRequest $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string requestId An optional request ID to identify requests.
48   * Specify a unique request ID so that if you must retry your request, the
49   * server will know to ignore the request if it has already been completed. For
50   * example, consider a situation where you make an initial request and the
51   * request times out. If you make the request again with the same request ID,
52   * the server can check if original operation with the same request ID was
53   * received, and if so, will ignore the second request. This prevents clients
54   * from accidentally creating duplicate commitments. The request ID must be a
55   * valid UUID with the exception that zero UUID is not supported (
56   * 00000000-0000-0000-0000-000000000000).
57   * @return Operation
58   */
59  public function attachNetworkEndpoints($project, $networkEndpointGroup, GlobalNetworkEndpointGroupsAttachEndpointsRequest $postBody, $optParams = [])
60  {
61    $params = ['project' => $project, 'networkEndpointGroup' => $networkEndpointGroup, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('attachNetworkEndpoints', [$params], Operation::class);
64  }
65  /**
66   * Deletes the specified network endpoint group.Note that the NEG cannot be
67   * deleted if there are backend services referencing it.
68   * (globalNetworkEndpointGroups.delete)
69   *
70   * @param string $project Project ID for this request.
71   * @param string $networkEndpointGroup The name of the network endpoint group to
72   * delete. It should comply with RFC1035.
73   * @param array $optParams Optional parameters.
74   *
75   * @opt_param string requestId An optional request ID to identify requests.
76   * Specify a unique request ID so that if you must retry your request, the
77   * server will know to ignore the request if it has already been completed. For
78   * example, consider a situation where you make an initial request and the
79   * request times out. If you make the request again with the same request ID,
80   * the server can check if original operation with the same request ID was
81   * received, and if so, will ignore the second request. This prevents clients
82   * from accidentally creating duplicate commitments. The request ID must be a
83   * valid UUID with the exception that zero UUID is not supported (
84   * 00000000-0000-0000-0000-000000000000).
85   * @return Operation
86   */
87  public function delete($project, $networkEndpointGroup, $optParams = [])
88  {
89    $params = ['project' => $project, 'networkEndpointGroup' => $networkEndpointGroup];
90    $params = array_merge($params, $optParams);
91    return $this->call('delete', [$params], Operation::class);
92  }
93  /**
94   * Detach the network endpoint from the specified network endpoint group.
95   * (globalNetworkEndpointGroups.detachNetworkEndpoints)
96   *
97   * @param string $project Project ID for this request.
98   * @param string $networkEndpointGroup The name of the network endpoint group
99   * where you are removing network endpoints. It should comply with RFC1035.
100   * @param GlobalNetworkEndpointGroupsDetachEndpointsRequest $postBody
101   * @param array $optParams Optional parameters.
102   *
103   * @opt_param string requestId An optional request ID to identify requests.
104   * Specify a unique request ID so that if you must retry your request, the
105   * server will know to ignore the request if it has already been completed. For
106   * example, consider a situation where you make an initial request and the
107   * request times out. If you make the request again with the same request ID,
108   * the server can check if original operation with the same request ID was
109   * received, and if so, will ignore the second request. This prevents clients
110   * from accidentally creating duplicate commitments. The request ID must be a
111   * valid UUID with the exception that zero UUID is not supported (
112   * 00000000-0000-0000-0000-000000000000).
113   * @return Operation
114   */
115  public function detachNetworkEndpoints($project, $networkEndpointGroup, GlobalNetworkEndpointGroupsDetachEndpointsRequest $postBody, $optParams = [])
116  {
117    $params = ['project' => $project, 'networkEndpointGroup' => $networkEndpointGroup, 'postBody' => $postBody];
118    $params = array_merge($params, $optParams);
119    return $this->call('detachNetworkEndpoints', [$params], Operation::class);
120  }
121  /**
122   * Returns the specified network endpoint group. Gets a list of available
123   * network endpoint groups by making a list() request.
124   * (globalNetworkEndpointGroups.get)
125   *
126   * @param string $project Project ID for this request.
127   * @param string $networkEndpointGroup The name of the network endpoint group.
128   * It should comply with RFC1035.
129   * @param array $optParams Optional parameters.
130   * @return NetworkEndpointGroup
131   */
132  public function get($project, $networkEndpointGroup, $optParams = [])
133  {
134    $params = ['project' => $project, 'networkEndpointGroup' => $networkEndpointGroup];
135    $params = array_merge($params, $optParams);
136    return $this->call('get', [$params], NetworkEndpointGroup::class);
137  }
138  /**
139   * Creates a network endpoint group in the specified project using the
140   * parameters that are included in the request.
141   * (globalNetworkEndpointGroups.insert)
142   *
143   * @param string $project Project ID for this request.
144   * @param NetworkEndpointGroup $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, NetworkEndpointGroup $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   * Retrieves the list of network endpoint groups that are located in the
167   * specified project.
168   * (globalNetworkEndpointGroups.listGlobalNetworkEndpointGroups)
169   *
170   * @param string $project Project ID for this request.
171   * @param array $optParams Optional parameters.
172   *
173   * @opt_param string filter A filter expression that filters resources listed in
174   * the response. The expression must specify the field name, an operator, and
175   * the value that you want to use for filtering. The value must be a string, a
176   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
177   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
178   * can exclude instances named `example-instance` by specifying `name !=
179   * example-instance`. The `:` operator can be used with string fields to match
180   * substrings. For non-string fields it is equivalent to the `=` operator. The
181   * `:*` comparison can be used to test whether a key has been defined. For
182   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
183   * You can also filter nested fields. For example, you could specify
184   * `scheduling.automaticRestart = false` to include instances only if they are
185   * not scheduled for automatic restarts. You can use filtering on nested fields
186   * to filter based on resource labels. To filter on multiple expressions,
187   * provide each separate expression within parentheses. For example: ```
188   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
189   * default, each expression is an `AND` expression. However, you can include
190   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
191   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
192   * (scheduling.automaticRestart = true) ```
193   * @opt_param string maxResults The maximum number of results per page that
194   * should be returned. If the number of available results is larger than
195   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
196   * get the next page of results in subsequent list requests. Acceptable values
197   * are `0` to `500`, inclusive. (Default: `500`)
198   * @opt_param string orderBy Sorts list results by a certain order. By default,
199   * results are returned in alphanumerical order based on the resource name. You
200   * can also sort results in descending order based on the creation timestamp
201   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
202   * `creationTimestamp` field in reverse chronological order (newest result
203   * first). Use this to sort resources like operations so that the newest
204   * operation is returned first. Currently, only sorting by `name` or
205   * `creationTimestamp desc` is supported.
206   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
207   * the `nextPageToken` returned by a previous list request to get the next page
208   * of results.
209   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
210   * which provides partial results in case of failure. The default value is
211   * false.
212   * @return NetworkEndpointGroupList
213   */
214  public function listGlobalNetworkEndpointGroups($project, $optParams = [])
215  {
216    $params = ['project' => $project];
217    $params = array_merge($params, $optParams);
218    return $this->call('list', [$params], NetworkEndpointGroupList::class);
219  }
220  /**
221   * Lists the network endpoints in the specified network endpoint group.
222   * (globalNetworkEndpointGroups.listNetworkEndpoints)
223   *
224   * @param string $project Project ID for this request.
225   * @param string $networkEndpointGroup The name of the network endpoint group
226   * from which you want to generate a list of included network endpoints. It
227   * should comply with RFC1035.
228   * @param array $optParams Optional parameters.
229   *
230   * @opt_param string filter A filter expression that filters resources listed in
231   * the response. The expression must specify the field name, an operator, and
232   * the value that you want to use for filtering. The value must be a string, a
233   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
234   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
235   * can exclude instances named `example-instance` by specifying `name !=
236   * example-instance`. The `:` operator can be used with string fields to match
237   * substrings. For non-string fields it is equivalent to the `=` operator. The
238   * `:*` comparison can be used to test whether a key has been defined. For
239   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
240   * You can also filter nested fields. For example, you could specify
241   * `scheduling.automaticRestart = false` to include instances only if they are
242   * not scheduled for automatic restarts. You can use filtering on nested fields
243   * to filter based on resource labels. To filter on multiple expressions,
244   * provide each separate expression within parentheses. For example: ```
245   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
246   * default, each expression is an `AND` expression. However, you can include
247   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
248   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
249   * (scheduling.automaticRestart = true) ```
250   * @opt_param string maxResults The maximum number of results per page that
251   * should be returned. If the number of available results is larger than
252   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
253   * get the next page of results in subsequent list requests. Acceptable values
254   * are `0` to `500`, inclusive. (Default: `500`)
255   * @opt_param string orderBy Sorts list results by a certain order. By default,
256   * results are returned in alphanumerical order based on the resource name. You
257   * can also sort results in descending order based on the creation timestamp
258   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
259   * `creationTimestamp` field in reverse chronological order (newest result
260   * first). Use this to sort resources like operations so that the newest
261   * operation is returned first. Currently, only sorting by `name` or
262   * `creationTimestamp desc` is supported.
263   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
264   * the `nextPageToken` returned by a previous list request to get the next page
265   * of results.
266   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
267   * which provides partial results in case of failure. The default value is
268   * false.
269   * @return NetworkEndpointGroupsListNetworkEndpoints
270   */
271  public function listNetworkEndpoints($project, $networkEndpointGroup, $optParams = [])
272  {
273    $params = ['project' => $project, 'networkEndpointGroup' => $networkEndpointGroup];
274    $params = array_merge($params, $optParams);
275    return $this->call('listNetworkEndpoints', [$params], NetworkEndpointGroupsListNetworkEndpoints::class);
276  }
277}
278
279// Adding a class alias for backwards compatibility with the previous class name.
280class_alias(GlobalNetworkEndpointGroups::class, 'Google_Service_Compute_Resource_GlobalNetworkEndpointGroups');
281