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