source: vendor/google/apiclient-services/src/Compute/Resource/InstanceGroups.php

Last change on this file was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 10 days ago

Upload project files

  • Property mode set to 100644
File size: 25.4 KB
Line 
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\InstanceGroup;
21use Google\Service\Compute\InstanceGroupAggregatedList;
22use Google\Service\Compute\InstanceGroupList;
23use Google\Service\Compute\InstanceGroupsAddInstancesRequest;
24use Google\Service\Compute\InstanceGroupsListInstances;
25use Google\Service\Compute\InstanceGroupsListInstancesRequest;
26use Google\Service\Compute\InstanceGroupsRemoveInstancesRequest;
27use Google\Service\Compute\InstanceGroupsSetNamedPortsRequest;
28use Google\Service\Compute\Operation;
29
30/**
31 * The "instanceGroups" collection of methods.
32 * Typical usage is:
33 * <code>
34 * $computeService = new Google\Service\Compute(...);
35 * $instanceGroups = $computeService->instanceGroups;
36 * </code>
37 */
38class InstanceGroups extends \Google\Service\Resource
39{
40 /**
41 * Adds a list of instances to the specified instance group. All of the
42 * instances in the instance group must be in the same network/subnetwork. Read
43 * Adding instances for more information. (instanceGroups.addInstances)
44 *
45 * @param string $project Project ID for this request.
46 * @param string $zone The name of the zone where the instance group is located.
47 * @param string $instanceGroup The name of the instance group where you are
48 * adding instances.
49 * @param InstanceGroupsAddInstancesRequest $postBody
50 * @param array $optParams Optional parameters.
51 *
52 * @opt_param string requestId An optional request ID to identify requests.
53 * Specify a unique request ID so that if you must retry your request, the
54 * server will know to ignore the request if it has already been completed. For
55 * example, consider a situation where you make an initial request and the
56 * request times out. If you make the request again with the same request ID,
57 * the server can check if original operation with the same request ID was
58 * received, and if so, will ignore the second request. This prevents clients
59 * from accidentally creating duplicate commitments. The request ID must be a
60 * valid UUID with the exception that zero UUID is not supported (
61 * 00000000-0000-0000-0000-000000000000).
62 * @return Operation
63 * @throws \Google\Service\Exception
64 */
65 public function addInstances($project, $zone, $instanceGroup, InstanceGroupsAddInstancesRequest $postBody, $optParams = [])
66 {
67 $params = ['project' => $project, 'zone' => $zone, 'instanceGroup' => $instanceGroup, 'postBody' => $postBody];
68 $params = array_merge($params, $optParams);
69 return $this->call('addInstances', [$params], Operation::class);
70 }
71 /**
72 * Retrieves the list of instance groups and sorts them by zone. To prevent
73 * failure, Google recommends that you set the `returnPartialSuccess` parameter
74 * to `true`. (instanceGroups.aggregatedList)
75 *
76 * @param string $project Project ID for this request.
77 * @param array $optParams Optional parameters.
78 *
79 * @opt_param string filter A filter expression that filters resources listed in
80 * the response. Most Compute resources support two types of filter expressions:
81 * expressions that support regular expressions and expressions that follow API
82 * improvement proposal AIP-160. These two types of filter expressions cannot be
83 * mixed in one request. If you want to use AIP-160, your expression must
84 * specify the field name, an operator, and the value that you want to use for
85 * filtering. The value must be a string, a number, or a boolean. The operator
86 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
87 * are filtering Compute Engine instances, you can exclude instances named
88 * `example-instance` by specifying `name != example-instance`. The `:*`
89 * comparison can be used to test whether a key has been defined. For example,
90 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
91 * also filter nested fields. For example, you could specify
92 * `scheduling.automaticRestart = false` to include instances only if they are
93 * not scheduled for automatic restarts. You can use filtering on nested fields
94 * to filter based on resource labels. To filter on multiple expressions,
95 * provide each separate expression within parentheses. For example: ```
96 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
97 * default, each expression is an `AND` expression. However, you can include
98 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
99 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
100 * (scheduling.automaticRestart = true) ``` If you want to use a regular
101 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
102 * single un-parenthesized expression with or without quotes or against multiple
103 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
104 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
105 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
106 * interpreted as a regular expression using Google RE2 library syntax. The
107 * literal value must match the entire field. For example, to filter for
108 * instances that do not end with name "instance", you would use `name ne
109 * .*instance`. You cannot combine constraints on multiple fields using regular
110 * expressions.
111 * @opt_param bool includeAllScopes Indicates whether every visible scope for
112 * each scope type (zone, region, global) should be included in the response.
113 * For new resource types added after this field, the flag has no effect as new
114 * resource types will always include every visible scope for each scope type in
115 * response. For resource types which predate this field, if this flag is
116 * omitted or false, only scopes of the scope types where the resource type is
117 * expected to be found will be included.
118 * @opt_param string maxResults The maximum number of results per page that
119 * should be returned. If the number of available results is larger than
120 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
121 * get the next page of results in subsequent list requests. Acceptable values
122 * are `0` to `500`, inclusive. (Default: `500`)
123 * @opt_param string orderBy Sorts list results by a certain order. By default,
124 * results are returned in alphanumerical order based on the resource name. You
125 * can also sort results in descending order based on the creation timestamp
126 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
127 * `creationTimestamp` field in reverse chronological order (newest result
128 * first). Use this to sort resources like operations so that the newest
129 * operation is returned first. Currently, only sorting by `name` or
130 * `creationTimestamp desc` is supported.
131 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
132 * the `nextPageToken` returned by a previous list request to get the next page
133 * of results.
134 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
135 * which provides partial results in case of failure. The default value is
136 * false. For example, when partial success behavior is enabled, aggregatedList
137 * for a single zone scope either returns all resources in the zone or no
138 * resources, with an error code.
139 * @opt_param string serviceProjectNumber The Shared VPC service project id or
140 * service project number for which aggregated list request is invoked for
141 * subnetworks list-usable api.
142 * @return InstanceGroupAggregatedList
143 * @throws \Google\Service\Exception
144 */
145 public function aggregatedList($project, $optParams = [])
146 {
147 $params = ['project' => $project];
148 $params = array_merge($params, $optParams);
149 return $this->call('aggregatedList', [$params], InstanceGroupAggregatedList::class);
150 }
151 /**
152 * Deletes the specified instance group. The instances in the group are not
153 * deleted. Note that instance group must not belong to a backend service. Read
154 * Deleting an instance group for more information. (instanceGroups.delete)
155 *
156 * @param string $project Project ID for this request.
157 * @param string $zone The name of the zone where the instance group is located.
158 * @param string $instanceGroup The name of the instance group to delete.
159 * @param array $optParams Optional parameters.
160 *
161 * @opt_param string requestId An optional request ID to identify requests.
162 * Specify a unique request ID so that if you must retry your request, the
163 * server will know to ignore the request if it has already been completed. For
164 * example, consider a situation where you make an initial request and the
165 * request times out. If you make the request again with the same request ID,
166 * the server can check if original operation with the same request ID was
167 * received, and if so, will ignore the second request. This prevents clients
168 * from accidentally creating duplicate commitments. The request ID must be a
169 * valid UUID with the exception that zero UUID is not supported (
170 * 00000000-0000-0000-0000-000000000000).
171 * @return Operation
172 * @throws \Google\Service\Exception
173 */
174 public function delete($project, $zone, $instanceGroup, $optParams = [])
175 {
176 $params = ['project' => $project, 'zone' => $zone, 'instanceGroup' => $instanceGroup];
177 $params = array_merge($params, $optParams);
178 return $this->call('delete', [$params], Operation::class);
179 }
180 /**
181 * Returns the specified zonal instance group. Get a list of available zonal
182 * instance groups by making a list() request. For managed instance groups, use
183 * the instanceGroupManagers or regionInstanceGroupManagers methods instead.
184 * (instanceGroups.get)
185 *
186 * @param string $project Project ID for this request.
187 * @param string $zone The name of the zone where the instance group is located.
188 * @param string $instanceGroup The name of the instance group.
189 * @param array $optParams Optional parameters.
190 * @return InstanceGroup
191 * @throws \Google\Service\Exception
192 */
193 public function get($project, $zone, $instanceGroup, $optParams = [])
194 {
195 $params = ['project' => $project, 'zone' => $zone, 'instanceGroup' => $instanceGroup];
196 $params = array_merge($params, $optParams);
197 return $this->call('get', [$params], InstanceGroup::class);
198 }
199 /**
200 * Creates an instance group in the specified project using the parameters that
201 * are included in the request. (instanceGroups.insert)
202 *
203 * @param string $project Project ID for this request.
204 * @param string $zone The name of the zone where you want to create the
205 * instance group.
206 * @param InstanceGroup $postBody
207 * @param array $optParams Optional parameters.
208 *
209 * @opt_param string requestId An optional request ID to identify requests.
210 * Specify a unique request ID so that if you must retry your request, the
211 * server will know to ignore the request if it has already been completed. For
212 * example, consider a situation where you make an initial request and the
213 * request times out. If you make the request again with the same request ID,
214 * the server can check if original operation with the same request ID was
215 * received, and if so, will ignore the second request. This prevents clients
216 * from accidentally creating duplicate commitments. The request ID must be a
217 * valid UUID with the exception that zero UUID is not supported (
218 * 00000000-0000-0000-0000-000000000000).
219 * @return Operation
220 * @throws \Google\Service\Exception
221 */
222 public function insert($project, $zone, InstanceGroup $postBody, $optParams = [])
223 {
224 $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody];
225 $params = array_merge($params, $optParams);
226 return $this->call('insert', [$params], Operation::class);
227 }
228 /**
229 * Retrieves the list of zonal instance group resources contained within the
230 * specified zone. For managed instance groups, use the instanceGroupManagers or
231 * regionInstanceGroupManagers methods instead.
232 * (instanceGroups.listInstanceGroups)
233 *
234 * @param string $project Project ID for this request.
235 * @param string $zone The name of the zone where the instance group is located.
236 * @param array $optParams Optional parameters.
237 *
238 * @opt_param string filter A filter expression that filters resources listed in
239 * the response. Most Compute resources support two types of filter expressions:
240 * expressions that support regular expressions and expressions that follow API
241 * improvement proposal AIP-160. These two types of filter expressions cannot be
242 * mixed in one request. If you want to use AIP-160, your expression must
243 * specify the field name, an operator, and the value that you want to use for
244 * filtering. The value must be a string, a number, or a boolean. The operator
245 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
246 * are filtering Compute Engine instances, you can exclude instances named
247 * `example-instance` by specifying `name != example-instance`. The `:*`
248 * comparison can be used to test whether a key has been defined. For example,
249 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
250 * also filter nested fields. For example, you could specify
251 * `scheduling.automaticRestart = false` to include instances only if they are
252 * not scheduled for automatic restarts. You can use filtering on nested fields
253 * to filter based on resource labels. To filter on multiple expressions,
254 * provide each separate expression within parentheses. For example: ```
255 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
256 * default, each expression is an `AND` expression. However, you can include
257 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
258 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
259 * (scheduling.automaticRestart = true) ``` If you want to use a regular
260 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
261 * single un-parenthesized expression with or without quotes or against multiple
262 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
263 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
264 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
265 * interpreted as a regular expression using Google RE2 library syntax. The
266 * literal value must match the entire field. For example, to filter for
267 * instances that do not end with name "instance", you would use `name ne
268 * .*instance`. You cannot combine constraints on multiple fields using regular
269 * expressions.
270 * @opt_param string maxResults The maximum number of results per page that
271 * should be returned. If the number of available results is larger than
272 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
273 * get the next page of results in subsequent list requests. Acceptable values
274 * are `0` to `500`, inclusive. (Default: `500`)
275 * @opt_param string orderBy Sorts list results by a certain order. By default,
276 * results are returned in alphanumerical order based on the resource name. You
277 * can also sort results in descending order based on the creation timestamp
278 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
279 * `creationTimestamp` field in reverse chronological order (newest result
280 * first). Use this to sort resources like operations so that the newest
281 * operation is returned first. Currently, only sorting by `name` or
282 * `creationTimestamp desc` is supported.
283 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
284 * the `nextPageToken` returned by a previous list request to get the next page
285 * of results.
286 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
287 * which provides partial results in case of failure. The default value is
288 * false. For example, when partial success behavior is enabled, aggregatedList
289 * for a single zone scope either returns all resources in the zone or no
290 * resources, with an error code.
291 * @return InstanceGroupList
292 * @throws \Google\Service\Exception
293 */
294 public function listInstanceGroups($project, $zone, $optParams = [])
295 {
296 $params = ['project' => $project, 'zone' => $zone];
297 $params = array_merge($params, $optParams);
298 return $this->call('list', [$params], InstanceGroupList::class);
299 }
300 /**
301 * Lists the instances in the specified instance group. The orderBy query
302 * parameter is not supported. The filter query parameter is supported, but only
303 * for expressions that use `eq` (equal) or `ne` (not equal) operators.
304 * (instanceGroups.listInstances)
305 *
306 * @param string $project Project ID for this request.
307 * @param string $zone The name of the zone where the instance group is located.
308 * @param string $instanceGroup The name of the instance group from which you
309 * want to generate a list of included instances.
310 * @param InstanceGroupsListInstancesRequest $postBody
311 * @param array $optParams Optional parameters.
312 *
313 * @opt_param string filter A filter expression that filters resources listed in
314 * the response. Most Compute resources support two types of filter expressions:
315 * expressions that support regular expressions and expressions that follow API
316 * improvement proposal AIP-160. These two types of filter expressions cannot be
317 * mixed in one request. If you want to use AIP-160, your expression must
318 * specify the field name, an operator, and the value that you want to use for
319 * filtering. The value must be a string, a number, or a boolean. The operator
320 * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
321 * are filtering Compute Engine instances, you can exclude instances named
322 * `example-instance` by specifying `name != example-instance`. The `:*`
323 * comparison can be used to test whether a key has been defined. For example,
324 * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
325 * also filter nested fields. For example, you could specify
326 * `scheduling.automaticRestart = false` to include instances only if they are
327 * not scheduled for automatic restarts. You can use filtering on nested fields
328 * to filter based on resource labels. To filter on multiple expressions,
329 * provide each separate expression within parentheses. For example: ```
330 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
331 * default, each expression is an `AND` expression. However, you can include
332 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
333 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
334 * (scheduling.automaticRestart = true) ``` If you want to use a regular
335 * expression, use the `eq` (equal) or `ne` (not equal) operator against a
336 * single un-parenthesized expression with or without quotes or against multiple
337 * parenthesized expressions. Examples: `fieldname eq unquoted literal`
338 * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
339 * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
340 * interpreted as a regular expression using Google RE2 library syntax. The
341 * literal value must match the entire field. For example, to filter for
342 * instances that do not end with name "instance", you would use `name ne
343 * .*instance`. You cannot combine constraints on multiple fields using regular
344 * expressions.
345 * @opt_param string maxResults The maximum number of results per page that
346 * should be returned. If the number of available results is larger than
347 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
348 * get the next page of results in subsequent list requests. Acceptable values
349 * are `0` to `500`, inclusive. (Default: `500`)
350 * @opt_param string orderBy Sorts list results by a certain order. By default,
351 * results are returned in alphanumerical order based on the resource name. You
352 * can also sort results in descending order based on the creation timestamp
353 * using `orderBy="creationTimestamp desc"`. This sorts results based on the
354 * `creationTimestamp` field in reverse chronological order (newest result
355 * first). Use this to sort resources like operations so that the newest
356 * operation is returned first. Currently, only sorting by `name` or
357 * `creationTimestamp desc` is supported.
358 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
359 * the `nextPageToken` returned by a previous list request to get the next page
360 * of results.
361 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
362 * which provides partial results in case of failure. The default value is
363 * false. For example, when partial success behavior is enabled, aggregatedList
364 * for a single zone scope either returns all resources in the zone or no
365 * resources, with an error code.
366 * @return InstanceGroupsListInstances
367 * @throws \Google\Service\Exception
368 */
369 public function listInstances($project, $zone, $instanceGroup, InstanceGroupsListInstancesRequest $postBody, $optParams = [])
370 {
371 $params = ['project' => $project, 'zone' => $zone, 'instanceGroup' => $instanceGroup, 'postBody' => $postBody];
372 $params = array_merge($params, $optParams);
373 return $this->call('listInstances', [$params], InstanceGroupsListInstances::class);
374 }
375 /**
376 * Removes one or more instances from the specified instance group, but does not
377 * delete those instances. If the group is part of a backend service that has
378 * enabled connection draining, it can take up to 60 seconds after the
379 * connection draining duration before the VM instance is removed or deleted.
380 * (instanceGroups.removeInstances)
381 *
382 * @param string $project Project ID for this request.
383 * @param string $zone The name of the zone where the instance group is located.
384 * @param string $instanceGroup The name of the instance group where the
385 * specified instances will be removed.
386 * @param InstanceGroupsRemoveInstancesRequest $postBody
387 * @param array $optParams Optional parameters.
388 *
389 * @opt_param string requestId An optional request ID to identify requests.
390 * Specify a unique request ID so that if you must retry your request, the
391 * server will know to ignore the request if it has already been completed. For
392 * example, consider a situation where you make an initial request and the
393 * request times out. If you make the request again with the same request ID,
394 * the server can check if original operation with the same request ID was
395 * received, and if so, will ignore the second request. This prevents clients
396 * from accidentally creating duplicate commitments. The request ID must be a
397 * valid UUID with the exception that zero UUID is not supported (
398 * 00000000-0000-0000-0000-000000000000).
399 * @return Operation
400 * @throws \Google\Service\Exception
401 */
402 public function removeInstances($project, $zone, $instanceGroup, InstanceGroupsRemoveInstancesRequest $postBody, $optParams = [])
403 {
404 $params = ['project' => $project, 'zone' => $zone, 'instanceGroup' => $instanceGroup, 'postBody' => $postBody];
405 $params = array_merge($params, $optParams);
406 return $this->call('removeInstances', [$params], Operation::class);
407 }
408 /**
409 * Sets the named ports for the specified instance group.
410 * (instanceGroups.setNamedPorts)
411 *
412 * @param string $project Project ID for this request.
413 * @param string $zone The name of the zone where the instance group is located.
414 * @param string $instanceGroup The name of the instance group where the named
415 * ports are updated.
416 * @param InstanceGroupsSetNamedPortsRequest $postBody
417 * @param array $optParams Optional parameters.
418 *
419 * @opt_param string requestId An optional request ID to identify requests.
420 * Specify a unique request ID so that if you must retry your request, the
421 * server will know to ignore the request if it has already been completed. For
422 * example, consider a situation where you make an initial request and the
423 * request times out. If you make the request again with the same request ID,
424 * the server can check if original operation with the same request ID was
425 * received, and if so, will ignore the second request. This prevents clients
426 * from accidentally creating duplicate commitments. The request ID must be a
427 * valid UUID with the exception that zero UUID is not supported (
428 * 00000000-0000-0000-0000-000000000000).
429 * @return Operation
430 * @throws \Google\Service\Exception
431 */
432 public function setNamedPorts($project, $zone, $instanceGroup, InstanceGroupsSetNamedPortsRequest $postBody, $optParams = [])
433 {
434 $params = ['project' => $project, 'zone' => $zone, 'instanceGroup' => $instanceGroup, 'postBody' => $postBody];
435 $params = array_merge($params, $optParams);
436 return $this->call('setNamedPorts', [$params], Operation::class);
437 }
438}
439
440// Adding a class alias for backwards compatibility with the previous class name.
441class_alias(InstanceGroups::class, 'Google_Service_Compute_Resource_InstanceGroups');
Note: See TracBrowser for help on using the repository browser.