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\Operation; 21use Google\Service\Compute\TargetInstance; 22use Google\Service\Compute\TargetInstanceAggregatedList; 23use Google\Service\Compute\TargetInstanceList; 24 25/** 26 * The "targetInstances" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $computeService = new Google\Service\Compute(...); 30 * $targetInstances = $computeService->targetInstances; 31 * </code> 32 */ 33class TargetInstances extends \Google\Service\Resource 34{ 35 /** 36 * Retrieves an aggregated list of target instances. 37 * (targetInstances.aggregatedList) 38 * 39 * @param string $project Project ID for this request. 40 * @param array $optParams Optional parameters. 41 * 42 * @opt_param string filter A filter expression that filters resources listed in 43 * the response. The expression must specify the field name, an operator, and 44 * the value that you want to use for filtering. The value must be a string, a 45 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 46 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 47 * can exclude instances named `example-instance` by specifying `name != 48 * example-instance`. The `:` operator can be used with string fields to match 49 * substrings. For non-string fields it is equivalent to the `=` operator. The 50 * `:*` comparison can be used to test whether a key has been defined. For 51 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 52 * You can also filter nested fields. For example, you could specify 53 * `scheduling.automaticRestart = false` to include instances only if they are 54 * not scheduled for automatic restarts. You can use filtering on nested fields 55 * to filter based on resource labels. To filter on multiple expressions, 56 * provide each separate expression within parentheses. For example: ``` 57 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 58 * default, each expression is an `AND` expression. However, you can include 59 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 60 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 61 * (scheduling.automaticRestart = true) ``` 62 * @opt_param bool includeAllScopes Indicates whether every visible scope for 63 * each scope type (zone, region, global) should be included in the response. 64 * For new resource types added after this field, the flag has no effect as new 65 * resource types will always include every visible scope for each scope type in 66 * response. For resource types which predate this field, if this flag is 67 * omitted or false, only scopes of the scope types where the resource type is 68 * expected to be found will be included. 69 * @opt_param string maxResults The maximum number of results per page that 70 * should be returned. If the number of available results is larger than 71 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 72 * get the next page of results in subsequent list requests. Acceptable values 73 * are `0` to `500`, inclusive. (Default: `500`) 74 * @opt_param string orderBy Sorts list results by a certain order. By default, 75 * results are returned in alphanumerical order based on the resource name. You 76 * can also sort results in descending order based on the creation timestamp 77 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 78 * `creationTimestamp` field in reverse chronological order (newest result 79 * first). Use this to sort resources like operations so that the newest 80 * operation is returned first. Currently, only sorting by `name` or 81 * `creationTimestamp desc` is supported. 82 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 83 * the `nextPageToken` returned by a previous list request to get the next page 84 * of results. 85 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 86 * which provides partial results in case of failure. The default value is 87 * false. 88 * @return TargetInstanceAggregatedList 89 */ 90 public function aggregatedList($project, $optParams = []) 91 { 92 $params = ['project' => $project]; 93 $params = array_merge($params, $optParams); 94 return $this->call('aggregatedList', [$params], TargetInstanceAggregatedList::class); 95 } 96 /** 97 * Deletes the specified TargetInstance resource. (targetInstances.delete) 98 * 99 * @param string $project Project ID for this request. 100 * @param string $zone Name of the zone scoping this request. 101 * @param string $targetInstance Name of the TargetInstance resource to delete. 102 * @param array $optParams Optional parameters. 103 * 104 * @opt_param string requestId An optional request ID to identify requests. 105 * Specify a unique request ID so that if you must retry your request, the 106 * server will know to ignore the request if it has already been completed. For 107 * example, consider a situation where you make an initial request and the 108 * request times out. If you make the request again with the same request ID, 109 * the server can check if original operation with the same request ID was 110 * received, and if so, will ignore the second request. This prevents clients 111 * from accidentally creating duplicate commitments. The request ID must be a 112 * valid UUID with the exception that zero UUID is not supported ( 113 * 00000000-0000-0000-0000-000000000000). 114 * @return Operation 115 */ 116 public function delete($project, $zone, $targetInstance, $optParams = []) 117 { 118 $params = ['project' => $project, 'zone' => $zone, 'targetInstance' => $targetInstance]; 119 $params = array_merge($params, $optParams); 120 return $this->call('delete', [$params], Operation::class); 121 } 122 /** 123 * Returns the specified TargetInstance resource. Gets a list of available 124 * target instances by making a list() request. (targetInstances.get) 125 * 126 * @param string $project Project ID for this request. 127 * @param string $zone Name of the zone scoping this request. 128 * @param string $targetInstance Name of the TargetInstance resource to return. 129 * @param array $optParams Optional parameters. 130 * @return TargetInstance 131 */ 132 public function get($project, $zone, $targetInstance, $optParams = []) 133 { 134 $params = ['project' => $project, 'zone' => $zone, 'targetInstance' => $targetInstance]; 135 $params = array_merge($params, $optParams); 136 return $this->call('get', [$params], TargetInstance::class); 137 } 138 /** 139 * Creates a TargetInstance resource in the specified project and zone using the 140 * data included in the request. (targetInstances.insert) 141 * 142 * @param string $project Project ID for this request. 143 * @param string $zone Name of the zone scoping this request. 144 * @param TargetInstance $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, $zone, TargetInstance $postBody, $optParams = []) 160 { 161 $params = ['project' => $project, 'zone' => $zone, 'postBody' => $postBody]; 162 $params = array_merge($params, $optParams); 163 return $this->call('insert', [$params], Operation::class); 164 } 165 /** 166 * Retrieves a list of TargetInstance resources available to the specified 167 * project and zone. (targetInstances.listTargetInstances) 168 * 169 * @param string $project Project ID for this request. 170 * @param string $zone Name of the zone scoping 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 TargetInstanceList 213 */ 214 public function listTargetInstances($project, $zone, $optParams = []) 215 { 216 $params = ['project' => $project, 'zone' => $zone]; 217 $params = array_merge($params, $optParams); 218 return $this->call('list', [$params], TargetInstanceList::class); 219 } 220} 221 222// Adding a class alias for backwards compatibility with the previous class name. 223class_alias(TargetInstances::class, 'Google_Service_Compute_Resource_TargetInstances'); 224