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\Operation;
22use Google\Service\Compute\RegionInstanceGroupList;
23use Google\Service\Compute\RegionInstanceGroupsListInstances;
24use Google\Service\Compute\RegionInstanceGroupsListInstancesRequest;
25use Google\Service\Compute\RegionInstanceGroupsSetNamedPortsRequest;
26
27/**
28 * The "regionInstanceGroups" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $computeService = new Google\Service\Compute(...);
32 *   $regionInstanceGroups = $computeService->regionInstanceGroups;
33 *  </code>
34 */
35class RegionInstanceGroups extends \Google\Service\Resource
36{
37  /**
38   * Returns the specified instance group resource. (regionInstanceGroups.get)
39   *
40   * @param string $project Project ID for this request.
41   * @param string $region Name of the region scoping this request.
42   * @param string $instanceGroup Name of the instance group resource to return.
43   * @param array $optParams Optional parameters.
44   * @return InstanceGroup
45   */
46  public function get($project, $region, $instanceGroup, $optParams = [])
47  {
48    $params = ['project' => $project, 'region' => $region, 'instanceGroup' => $instanceGroup];
49    $params = array_merge($params, $optParams);
50    return $this->call('get', [$params], InstanceGroup::class);
51  }
52  /**
53   * Retrieves the list of instance group resources contained within the specified
54   * region. (regionInstanceGroups.listRegionInstanceGroups)
55   *
56   * @param string $project Project ID for this request.
57   * @param string $region Name of the region scoping this request.
58   * @param array $optParams Optional parameters.
59   *
60   * @opt_param string filter A filter expression that filters resources listed in
61   * the response. The expression must specify the field name, an operator, and
62   * the value that you want to use for filtering. The value must be a string, a
63   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
64   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
65   * can exclude instances named `example-instance` by specifying `name !=
66   * example-instance`. The `:` operator can be used with string fields to match
67   * substrings. For non-string fields it is equivalent to the `=` operator. The
68   * `:*` comparison can be used to test whether a key has been defined. For
69   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
70   * You can also filter nested fields. For example, you could specify
71   * `scheduling.automaticRestart = false` to include instances only if they are
72   * not scheduled for automatic restarts. You can use filtering on nested fields
73   * to filter based on resource labels. To filter on multiple expressions,
74   * provide each separate expression within parentheses. For example: ```
75   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
76   * default, each expression is an `AND` expression. However, you can include
77   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
78   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
79   * (scheduling.automaticRestart = true) ```
80   * @opt_param string maxResults The maximum number of results per page that
81   * should be returned. If the number of available results is larger than
82   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
83   * get the next page of results in subsequent list requests. Acceptable values
84   * are `0` to `500`, inclusive. (Default: `500`)
85   * @opt_param string orderBy Sorts list results by a certain order. By default,
86   * results are returned in alphanumerical order based on the resource name. You
87   * can also sort results in descending order based on the creation timestamp
88   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
89   * `creationTimestamp` field in reverse chronological order (newest result
90   * first). Use this to sort resources like operations so that the newest
91   * operation is returned first. Currently, only sorting by `name` or
92   * `creationTimestamp desc` is supported.
93   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
94   * the `nextPageToken` returned by a previous list request to get the next page
95   * of results.
96   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
97   * which provides partial results in case of failure. The default value is
98   * false.
99   * @return RegionInstanceGroupList
100   */
101  public function listRegionInstanceGroups($project, $region, $optParams = [])
102  {
103    $params = ['project' => $project, 'region' => $region];
104    $params = array_merge($params, $optParams);
105    return $this->call('list', [$params], RegionInstanceGroupList::class);
106  }
107  /**
108   * Lists the instances in the specified instance group and displays information
109   * about the named ports. Depending on the specified options, this method can
110   * list all instances or only the instances that are running. The orderBy query
111   * parameter is not supported. (regionInstanceGroups.listInstances)
112   *
113   * @param string $project Project ID for this request.
114   * @param string $region Name of the region scoping this request.
115   * @param string $instanceGroup Name of the regional instance group for which we
116   * want to list the instances.
117   * @param RegionInstanceGroupsListInstancesRequest $postBody
118   * @param array $optParams Optional parameters.
119   *
120   * @opt_param string filter A filter expression that filters resources listed in
121   * the response. The expression must specify the field name, an operator, and
122   * the value that you want to use for filtering. The value must be a string, a
123   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
124   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
125   * can exclude instances named `example-instance` by specifying `name !=
126   * example-instance`. The `:` operator can be used with string fields to match
127   * substrings. For non-string fields it is equivalent to the `=` operator. The
128   * `:*` comparison can be used to test whether a key has been defined. For
129   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
130   * You can also filter nested fields. For example, you could specify
131   * `scheduling.automaticRestart = false` to include instances only if they are
132   * not scheduled for automatic restarts. You can use filtering on nested fields
133   * to filter based on resource labels. To filter on multiple expressions,
134   * provide each separate expression within parentheses. For example: ```
135   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
136   * default, each expression is an `AND` expression. However, you can include
137   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
138   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
139   * (scheduling.automaticRestart = true) ```
140   * @opt_param string maxResults The maximum number of results per page that
141   * should be returned. If the number of available results is larger than
142   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
143   * get the next page of results in subsequent list requests. Acceptable values
144   * are `0` to `500`, inclusive. (Default: `500`)
145   * @opt_param string orderBy Sorts list results by a certain order. By default,
146   * results are returned in alphanumerical order based on the resource name. You
147   * can also sort results in descending order based on the creation timestamp
148   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
149   * `creationTimestamp` field in reverse chronological order (newest result
150   * first). Use this to sort resources like operations so that the newest
151   * operation is returned first. Currently, only sorting by `name` or
152   * `creationTimestamp desc` is supported.
153   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
154   * the `nextPageToken` returned by a previous list request to get the next page
155   * of results.
156   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
157   * which provides partial results in case of failure. The default value is
158   * false.
159   * @return RegionInstanceGroupsListInstances
160   */
161  public function listInstances($project, $region, $instanceGroup, RegionInstanceGroupsListInstancesRequest $postBody, $optParams = [])
162  {
163    $params = ['project' => $project, 'region' => $region, 'instanceGroup' => $instanceGroup, 'postBody' => $postBody];
164    $params = array_merge($params, $optParams);
165    return $this->call('listInstances', [$params], RegionInstanceGroupsListInstances::class);
166  }
167  /**
168   * Sets the named ports for the specified regional instance group.
169   * (regionInstanceGroups.setNamedPorts)
170   *
171   * @param string $project Project ID for this request.
172   * @param string $region Name of the region scoping this request.
173   * @param string $instanceGroup The name of the regional instance group where
174   * the named ports are updated.
175   * @param RegionInstanceGroupsSetNamedPortsRequest $postBody
176   * @param array $optParams Optional parameters.
177   *
178   * @opt_param string requestId An optional request ID to identify requests.
179   * Specify a unique request ID so that if you must retry your request, the
180   * server will know to ignore the request if it has already been completed. For
181   * example, consider a situation where you make an initial request and the
182   * request times out. If you make the request again with the same request ID,
183   * the server can check if original operation with the same request ID was
184   * received, and if so, will ignore the second request. This prevents clients
185   * from accidentally creating duplicate commitments. The request ID must be a
186   * valid UUID with the exception that zero UUID is not supported (
187   * 00000000-0000-0000-0000-000000000000).
188   * @return Operation
189   */
190  public function setNamedPorts($project, $region, $instanceGroup, RegionInstanceGroupsSetNamedPortsRequest $postBody, $optParams = [])
191  {
192    $params = ['project' => $project, 'region' => $region, 'instanceGroup' => $instanceGroup, 'postBody' => $postBody];
193    $params = array_merge($params, $optParams);
194    return $this->call('setNamedPorts', [$params], Operation::class);
195  }
196}
197
198// Adding a class alias for backwards compatibility with the previous class name.
199class_alias(RegionInstanceGroups::class, 'Google_Service_Compute_Resource_RegionInstanceGroups');
200