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\Policy; 22use Google\Service\Compute\RegionSetPolicyRequest; 23use Google\Service\Compute\ServiceAttachment; 24use Google\Service\Compute\ServiceAttachmentAggregatedList; 25use Google\Service\Compute\ServiceAttachmentList; 26use Google\Service\Compute\TestPermissionsRequest; 27use Google\Service\Compute\TestPermissionsResponse; 28 29/** 30 * The "serviceAttachments" collection of methods. 31 * Typical usage is: 32 * <code> 33 * $computeService = new Google\Service\Compute(...); 34 * $serviceAttachments = $computeService->serviceAttachments; 35 * </code> 36 */ 37class ServiceAttachments extends \Google\Service\Resource 38{ 39 /** 40 * Retrieves the list of all ServiceAttachment resources, regional and global, 41 * available to the specified project. (serviceAttachments.aggregatedList) 42 * 43 * @param string $project Name of the project scoping this request. 44 * @param array $optParams Optional parameters. 45 * 46 * @opt_param string filter A filter expression that filters resources listed in 47 * the response. The expression must specify the field name, an operator, and 48 * the value that you want to use for filtering. The value must be a string, a 49 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 50 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 51 * can exclude instances named `example-instance` by specifying `name != 52 * example-instance`. The `:` operator can be used with string fields to match 53 * substrings. For non-string fields it is equivalent to the `=` operator. The 54 * `:*` comparison can be used to test whether a key has been defined. For 55 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 56 * You can also filter nested fields. For example, you could specify 57 * `scheduling.automaticRestart = false` to include instances only if they are 58 * not scheduled for automatic restarts. You can use filtering on nested fields 59 * to filter based on resource labels. To filter on multiple expressions, 60 * provide each separate expression within parentheses. For example: ``` 61 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 62 * default, each expression is an `AND` expression. However, you can include 63 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 64 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 65 * (scheduling.automaticRestart = true) ``` 66 * @opt_param bool includeAllScopes Indicates whether every visible scope for 67 * each scope type (zone, region, global) should be included in the response. 68 * For new resource types added after this field, the flag has no effect as new 69 * resource types will always include every visible scope for each scope type in 70 * response. For resource types which predate this field, if this flag is 71 * omitted or false, only scopes of the scope types where the resource type is 72 * expected to be found will be included. 73 * @opt_param string maxResults The maximum number of results per page that 74 * should be returned. If the number of available results is larger than 75 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 76 * get the next page of results in subsequent list requests. Acceptable values 77 * are `0` to `500`, inclusive. (Default: `500`) 78 * @opt_param string orderBy Sorts list results by a certain order. By default, 79 * results are returned in alphanumerical order based on the resource name. You 80 * can also sort results in descending order based on the creation timestamp 81 * using `orderBy="creationTimestamp desc"`. This sorts results based on the 82 * `creationTimestamp` field in reverse chronological order (newest result 83 * first). Use this to sort resources like operations so that the newest 84 * operation is returned first. Currently, only sorting by `name` or 85 * `creationTimestamp desc` is supported. 86 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 87 * the `nextPageToken` returned by a previous list request to get the next page 88 * of results. 89 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 90 * which provides partial results in case of failure. The default value is 91 * false. 92 * @return ServiceAttachmentAggregatedList 93 */ 94 public function aggregatedList($project, $optParams = []) 95 { 96 $params = ['project' => $project]; 97 $params = array_merge($params, $optParams); 98 return $this->call('aggregatedList', [$params], ServiceAttachmentAggregatedList::class); 99 } 100 /** 101 * Deletes the specified ServiceAttachment in the given scope 102 * (serviceAttachments.delete) 103 * 104 * @param string $project Project ID for this request. 105 * @param string $region Name of the region of this request. 106 * @param string $serviceAttachment Name of the ServiceAttachment resource to 107 * delete. 108 * @param array $optParams Optional parameters. 109 * 110 * @opt_param string requestId An optional request ID to identify requests. 111 * Specify a unique request ID so that if you must retry your request, the 112 * server will know to ignore the request if it has already been completed. For 113 * example, consider a situation where you make an initial request and the 114 * request times out. If you make the request again with the same request ID, 115 * the server can check if original operation with the same request ID was 116 * received, and if so, will ignore the second request. This prevents clients 117 * from accidentally creating duplicate commitments. The request ID must be a 118 * valid UUID with the exception that zero UUID is not supported ( 119 * 00000000-0000-0000-0000-000000000000). 120 * @return Operation 121 */ 122 public function delete($project, $region, $serviceAttachment, $optParams = []) 123 { 124 $params = ['project' => $project, 'region' => $region, 'serviceAttachment' => $serviceAttachment]; 125 $params = array_merge($params, $optParams); 126 return $this->call('delete', [$params], Operation::class); 127 } 128 /** 129 * Returns the specified ServiceAttachment resource in the given scope. 130 * (serviceAttachments.get) 131 * 132 * @param string $project Project ID for this request. 133 * @param string $region Name of the region of this request. 134 * @param string $serviceAttachment Name of the ServiceAttachment resource to 135 * return. 136 * @param array $optParams Optional parameters. 137 * @return ServiceAttachment 138 */ 139 public function get($project, $region, $serviceAttachment, $optParams = []) 140 { 141 $params = ['project' => $project, 'region' => $region, 'serviceAttachment' => $serviceAttachment]; 142 $params = array_merge($params, $optParams); 143 return $this->call('get', [$params], ServiceAttachment::class); 144 } 145 /** 146 * Gets the access control policy for a resource. May be empty if no such policy 147 * or resource exists. (serviceAttachments.getIamPolicy) 148 * 149 * @param string $project Project ID for this request. 150 * @param string $region The name of the region for this request. 151 * @param string $resource Name or id of the resource for this request. 152 * @param array $optParams Optional parameters. 153 * 154 * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version. 155 * @return Policy 156 */ 157 public function getIamPolicy($project, $region, $resource, $optParams = []) 158 { 159 $params = ['project' => $project, 'region' => $region, 'resource' => $resource]; 160 $params = array_merge($params, $optParams); 161 return $this->call('getIamPolicy', [$params], Policy::class); 162 } 163 /** 164 * Creates a ServiceAttachment in the specified project in the given scope using 165 * the parameters that are included in the request. (serviceAttachments.insert) 166 * 167 * @param string $project Project ID for this request. 168 * @param string $region Name of the region of this request. 169 * @param ServiceAttachment $postBody 170 * @param array $optParams Optional parameters. 171 * 172 * @opt_param string requestId An optional request ID to identify requests. 173 * Specify a unique request ID so that if you must retry your request, the 174 * server will know to ignore the request if it has already been completed. For 175 * example, consider a situation where you make an initial request and the 176 * request times out. If you make the request again with the same request ID, 177 * the server can check if original operation with the same request ID was 178 * received, and if so, will ignore the second request. This prevents clients 179 * from accidentally creating duplicate commitments. The request ID must be a 180 * valid UUID with the exception that zero UUID is not supported ( 181 * 00000000-0000-0000-0000-000000000000). 182 * @return Operation 183 */ 184 public function insert($project, $region, ServiceAttachment $postBody, $optParams = []) 185 { 186 $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody]; 187 $params = array_merge($params, $optParams); 188 return $this->call('insert', [$params], Operation::class); 189 } 190 /** 191 * Lists the ServiceAttachments for a project in the given scope. 192 * (serviceAttachments.listServiceAttachments) 193 * 194 * @param string $project Project ID for this request. 195 * @param string $region Name of the region of this request. 196 * @param array $optParams Optional parameters. 197 * 198 * @opt_param string filter A filter expression that filters resources listed in 199 * the response. The expression must specify the field name, an operator, and 200 * the value that you want to use for filtering. The value must be a string, a 201 * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, 202 * `>=` or `:`. For example, if you are filtering Compute Engine instances, you 203 * can exclude instances named `example-instance` by specifying `name != 204 * example-instance`. The `:` operator can be used with string fields to match 205 * substrings. For non-string fields it is equivalent to the `=` operator. The 206 * `:*` comparison can be used to test whether a key has been defined. For 207 * example, to find all objects with `owner` label use: ``` labels.owner:* ``` 208 * You can also filter nested fields. For example, you could specify 209 * `scheduling.automaticRestart = false` to include instances only if they are 210 * not scheduled for automatic restarts. You can use filtering on nested fields 211 * to filter based on resource labels. To filter on multiple expressions, 212 * provide each separate expression within parentheses. For example: ``` 213 * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By 214 * default, each expression is an `AND` expression. However, you can include 215 * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel 216 * Skylake") OR (cpuPlatform = "Intel Broadwell") AND 217 * (scheduling.automaticRestart = true) ``` 218 * @opt_param string maxResults The maximum number of results per page that 219 * should be returned. If the number of available results is larger than 220 * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to 221 * get the next page of results in subsequent list requests. Acceptable values 222 * are `0` to `500`, inclusive. (Default: `500`) 223 * @opt_param string orderBy Sorts list results by a certain order. By default, 224 * results are returned in alphanumerical order based on the resource name. You 225 * 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 228 * first). Use this to sort resources like operations so that the newest 229 * operation is returned first. Currently, only sorting by `name` or 230 * `creationTimestamp desc` is supported. 231 * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to 232 * the `nextPageToken` returned by a previous list request to get the next page 233 * of results. 234 * @opt_param bool returnPartialSuccess Opt-in for partial success behavior 235 * which provides partial results in case of failure. The default value is 236 * false. 237 * @return ServiceAttachmentList 238 */ 239 public function listServiceAttachments($project, $region, $optParams = []) 240 { 241 $params = ['project' => $project, 'region' => $region]; 242 $params = array_merge($params, $optParams); 243 return $this->call('list', [$params], ServiceAttachmentList::class); 244 } 245 /** 246 * Patches the specified ServiceAttachment resource with the data included in 247 * the request. This method supports PATCH semantics and uses JSON merge patch 248 * format and processing rules. (serviceAttachments.patch) 249 * 250 * @param string $project Project ID for this request. 251 * @param string $region The region scoping this request and should conform to 252 * RFC1035. 253 * @param string $serviceAttachment The resource id of the ServiceAttachment to 254 * patch. It should conform to RFC1035 resource name or be a string form on an 255 * unsigned long number. 256 * @param ServiceAttachment $postBody 257 * @param array $optParams Optional parameters. 258 * 259 * @opt_param string requestId An optional request ID to identify requests. 260 * Specify a unique request ID so that if you must retry your request, the 261 * server will know to ignore the request if it has already been completed. For 262 * example, consider a situation where you make an initial request and the 263 * request times out. If you make the request again with the same request ID, 264 * the server can check if original operation with the same request ID was 265 * received, and if so, will ignore the second request. This prevents clients 266 * from accidentally creating duplicate commitments. The request ID must be a 267 * valid UUID with the exception that zero UUID is not supported ( 268 * 00000000-0000-0000-0000-000000000000). 269 * @return Operation 270 */ 271 public function patch($project, $region, $serviceAttachment, ServiceAttachment $postBody, $optParams = []) 272 { 273 $params = ['project' => $project, 'region' => $region, 'serviceAttachment' => $serviceAttachment, 'postBody' => $postBody]; 274 $params = array_merge($params, $optParams); 275 return $this->call('patch', [$params], Operation::class); 276 } 277 /** 278 * Sets the access control policy on the specified resource. Replaces any 279 * existing policy. (serviceAttachments.setIamPolicy) 280 * 281 * @param string $project Project ID for this request. 282 * @param string $region The name of the region for this request. 283 * @param string $resource Name or id of the resource for this request. 284 * @param RegionSetPolicyRequest $postBody 285 * @param array $optParams Optional parameters. 286 * @return Policy 287 */ 288 public function setIamPolicy($project, $region, $resource, RegionSetPolicyRequest $postBody, $optParams = []) 289 { 290 $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody]; 291 $params = array_merge($params, $optParams); 292 return $this->call('setIamPolicy', [$params], Policy::class); 293 } 294 /** 295 * Returns permissions that a caller has on the specified resource. 296 * (serviceAttachments.testIamPermissions) 297 * 298 * @param string $project Project ID for this request. 299 * @param string $region The name of the region for this request. 300 * @param string $resource Name or id of the resource for this request. 301 * @param TestPermissionsRequest $postBody 302 * @param array $optParams Optional parameters. 303 * @return TestPermissionsResponse 304 */ 305 public function testIamPermissions($project, $region, $resource, TestPermissionsRequest $postBody, $optParams = []) 306 { 307 $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody]; 308 $params = array_merge($params, $optParams); 309 return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class); 310 } 311} 312 313// Adding a class alias for backwards compatibility with the previous class name. 314class_alias(ServiceAttachments::class, 'Google_Service_Compute_Resource_ServiceAttachments'); 315