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