[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\DeprecationStatus;
|
---|
| 21 | use Google\Service\Compute\GlobalSetLabelsRequest;
|
---|
| 22 | use Google\Service\Compute\GlobalSetPolicyRequest;
|
---|
| 23 | use Google\Service\Compute\Image;
|
---|
| 24 | use Google\Service\Compute\ImageList;
|
---|
| 25 | use Google\Service\Compute\Operation;
|
---|
| 26 | use Google\Service\Compute\Policy;
|
---|
| 27 | use Google\Service\Compute\TestPermissionsRequest;
|
---|
| 28 | use Google\Service\Compute\TestPermissionsResponse;
|
---|
| 29 |
|
---|
| 30 | /**
|
---|
| 31 | * The "images" collection of methods.
|
---|
| 32 | * Typical usage is:
|
---|
| 33 | * <code>
|
---|
| 34 | * $computeService = new Google\Service\Compute(...);
|
---|
| 35 | * $images = $computeService->images;
|
---|
| 36 | * </code>
|
---|
| 37 | */
|
---|
| 38 | class Images extends \Google\Service\Resource
|
---|
| 39 | {
|
---|
| 40 | /**
|
---|
| 41 | * Deletes the specified image. (images.delete)
|
---|
| 42 | *
|
---|
| 43 | * @param string $project Project ID for this request.
|
---|
| 44 | * @param string $image Name of the image resource to delete.
|
---|
| 45 | * @param array $optParams Optional parameters.
|
---|
| 46 | *
|
---|
| 47 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 48 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 49 | * server will know to ignore the request if it has already been completed. For
|
---|
| 50 | * example, consider a situation where you make an initial request and the
|
---|
| 51 | * request times out. If you make the request again with the same request ID,
|
---|
| 52 | * the server can check if original operation with the same request ID was
|
---|
| 53 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 54 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 55 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 56 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 57 | * @return Operation
|
---|
| 58 | * @throws \Google\Service\Exception
|
---|
| 59 | */
|
---|
| 60 | public function delete($project, $image, $optParams = [])
|
---|
| 61 | {
|
---|
| 62 | $params = ['project' => $project, 'image' => $image];
|
---|
| 63 | $params = array_merge($params, $optParams);
|
---|
| 64 | return $this->call('delete', [$params], Operation::class);
|
---|
| 65 | }
|
---|
| 66 | /**
|
---|
| 67 | * Sets the deprecation status of an image. If an empty request body is given,
|
---|
| 68 | * clears the deprecation status instead. (images.deprecate)
|
---|
| 69 | *
|
---|
| 70 | * @param string $project Project ID for this request.
|
---|
| 71 | * @param string $image Image name.
|
---|
| 72 | * @param DeprecationStatus $postBody
|
---|
| 73 | * @param array $optParams Optional parameters.
|
---|
| 74 | *
|
---|
| 75 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 76 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 77 | * server will know to ignore the request if it has already been completed. For
|
---|
| 78 | * example, consider a situation where you make an initial request and the
|
---|
| 79 | * request times out. If you make the request again with the same request ID,
|
---|
| 80 | * the server can check if original operation with the same request ID was
|
---|
| 81 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 82 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 83 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 84 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 85 | * @return Operation
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function deprecate($project, $image, DeprecationStatus $postBody, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['project' => $project, 'image' => $image, 'postBody' => $postBody];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('deprecate', [$params], Operation::class);
|
---|
| 93 | }
|
---|
| 94 | /**
|
---|
| 95 | * Returns the specified image. (images.get)
|
---|
| 96 | *
|
---|
| 97 | * @param string $project Project ID for this request.
|
---|
| 98 | * @param string $image Name of the image resource to return.
|
---|
| 99 | * @param array $optParams Optional parameters.
|
---|
| 100 | * @return Image
|
---|
| 101 | * @throws \Google\Service\Exception
|
---|
| 102 | */
|
---|
| 103 | public function get($project, $image, $optParams = [])
|
---|
| 104 | {
|
---|
| 105 | $params = ['project' => $project, 'image' => $image];
|
---|
| 106 | $params = array_merge($params, $optParams);
|
---|
| 107 | return $this->call('get', [$params], Image::class);
|
---|
| 108 | }
|
---|
| 109 | /**
|
---|
| 110 | * Returns the latest image that is part of an image family and is not
|
---|
| 111 | * deprecated. For more information on image families, see Public image families
|
---|
| 112 | * documentation. (images.getFromFamily)
|
---|
| 113 | *
|
---|
| 114 | * @param string $project The image project that the image belongs to. For
|
---|
| 115 | * example, to get a CentOS image, specify centos-cloud as the image project.
|
---|
| 116 | * @param string $family Name of the image family to search for.
|
---|
| 117 | * @param array $optParams Optional parameters.
|
---|
| 118 | * @return Image
|
---|
| 119 | * @throws \Google\Service\Exception
|
---|
| 120 | */
|
---|
| 121 | public function getFromFamily($project, $family, $optParams = [])
|
---|
| 122 | {
|
---|
| 123 | $params = ['project' => $project, 'family' => $family];
|
---|
| 124 | $params = array_merge($params, $optParams);
|
---|
| 125 | return $this->call('getFromFamily', [$params], Image::class);
|
---|
| 126 | }
|
---|
| 127 | /**
|
---|
| 128 | * Gets the access control policy for a resource. May be empty if no such policy
|
---|
| 129 | * or resource exists. (images.getIamPolicy)
|
---|
| 130 | *
|
---|
| 131 | * @param string $project Project ID for this request.
|
---|
| 132 | * @param string $resource Name or id of the resource for this request.
|
---|
| 133 | * @param array $optParams Optional parameters.
|
---|
| 134 | *
|
---|
| 135 | * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version.
|
---|
| 136 | * @return Policy
|
---|
| 137 | * @throws \Google\Service\Exception
|
---|
| 138 | */
|
---|
| 139 | public function getIamPolicy($project, $resource, $optParams = [])
|
---|
| 140 | {
|
---|
| 141 | $params = ['project' => $project, 'resource' => $resource];
|
---|
| 142 | $params = array_merge($params, $optParams);
|
---|
| 143 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 144 | }
|
---|
| 145 | /**
|
---|
| 146 | * Creates an image in the specified project using the data included in the
|
---|
| 147 | * request. (images.insert)
|
---|
| 148 | *
|
---|
| 149 | * @param string $project Project ID for this request.
|
---|
| 150 | * @param Image $postBody
|
---|
| 151 | * @param array $optParams Optional parameters.
|
---|
| 152 | *
|
---|
| 153 | * @opt_param bool forceCreate Force image creation if true.
|
---|
| 154 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 155 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 156 | * server will know to ignore the request if it has already been completed. For
|
---|
| 157 | * example, consider a situation where you make an initial request and the
|
---|
| 158 | * request times out. If you make the request again with the same request ID,
|
---|
| 159 | * the server can check if original operation with the same request ID was
|
---|
| 160 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 161 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 162 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 163 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 164 | * @return Operation
|
---|
| 165 | * @throws \Google\Service\Exception
|
---|
| 166 | */
|
---|
| 167 | public function insert($project, Image $postBody, $optParams = [])
|
---|
| 168 | {
|
---|
| 169 | $params = ['project' => $project, 'postBody' => $postBody];
|
---|
| 170 | $params = array_merge($params, $optParams);
|
---|
| 171 | return $this->call('insert', [$params], Operation::class);
|
---|
| 172 | }
|
---|
| 173 | /**
|
---|
| 174 | * Retrieves the list of custom images available to the specified project.
|
---|
| 175 | * Custom images are images you create that belong to your project. This method
|
---|
| 176 | * does not get any images that belong to other projects, including publicly-
|
---|
| 177 | * available images, like Debian 8. If you want to get a list of publicly-
|
---|
| 178 | * available images, use this method to make a request to the respective image
|
---|
| 179 | * project, such as debian-cloud or windows-cloud. (images.listImages)
|
---|
| 180 | *
|
---|
| 181 | * @param string $project Project ID for this request.
|
---|
| 182 | * @param array $optParams Optional parameters.
|
---|
| 183 | *
|
---|
| 184 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
| 185 | * the response. Most Compute resources support two types of filter expressions:
|
---|
| 186 | * expressions that support regular expressions and expressions that follow API
|
---|
| 187 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
| 188 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
| 189 | * specify the field name, an operator, and the value that you want to use for
|
---|
| 190 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
| 191 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
| 192 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
| 193 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
| 194 | * comparison can be used to test whether a key has been defined. For example,
|
---|
| 195 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
| 196 | * also filter nested fields. For example, you could specify
|
---|
| 197 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
| 198 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
| 199 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
| 200 | * provide each separate expression within parentheses. For example: ```
|
---|
| 201 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
| 202 | * default, each expression is an `AND` expression. However, you can include
|
---|
| 203 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
| 204 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
| 205 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
| 206 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
| 207 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
| 208 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
| 209 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
| 210 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
| 211 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
| 212 | * literal value must match the entire field. For example, to filter for
|
---|
| 213 | * instances that do not end with name "instance", you would use `name ne
|
---|
| 214 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
| 215 | * expressions.
|
---|
| 216 | * @opt_param string maxResults The maximum number of results per page that
|
---|
| 217 | * should be returned. If the number of available results is larger than
|
---|
| 218 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
| 219 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
| 220 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
| 221 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
| 222 | * results are returned in alphanumerical order based on the resource name. You
|
---|
| 223 | * can also sort results in descending order based on the creation timestamp
|
---|
| 224 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
| 225 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
| 226 | * first). Use this to sort resources like operations so that the newest
|
---|
| 227 | * operation is returned first. Currently, only sorting by `name` or
|
---|
| 228 | * `creationTimestamp desc` is supported.
|
---|
| 229 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
| 230 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
| 231 | * of results.
|
---|
| 232 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
| 233 | * which provides partial results in case of failure. The default value is
|
---|
| 234 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
| 235 | * for a single zone scope either returns all resources in the zone or no
|
---|
| 236 | * resources, with an error code.
|
---|
| 237 | * @return ImageList
|
---|
| 238 | * @throws \Google\Service\Exception
|
---|
| 239 | */
|
---|
| 240 | public function listImages($project, $optParams = [])
|
---|
| 241 | {
|
---|
| 242 | $params = ['project' => $project];
|
---|
| 243 | $params = array_merge($params, $optParams);
|
---|
| 244 | return $this->call('list', [$params], ImageList::class);
|
---|
| 245 | }
|
---|
| 246 | /**
|
---|
| 247 | * Patches the specified image with the data included in the request. Only the
|
---|
| 248 | * following fields can be modified: family, description, deprecation status.
|
---|
| 249 | * (images.patch)
|
---|
| 250 | *
|
---|
| 251 | * @param string $project Project ID for this request.
|
---|
| 252 | * @param string $image Name of the image resource to patch.
|
---|
| 253 | * @param Image $postBody
|
---|
| 254 | * @param array $optParams Optional parameters.
|
---|
| 255 | *
|
---|
| 256 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
| 257 | * Specify a unique request ID so that if you must retry your request, the
|
---|
| 258 | * server will know to ignore the request if it has already been completed. For
|
---|
| 259 | * example, consider a situation where you make an initial request and the
|
---|
| 260 | * request times out. If you make the request again with the same request ID,
|
---|
| 261 | * the server can check if original operation with the same request ID was
|
---|
| 262 | * received, and if so, will ignore the second request. This prevents clients
|
---|
| 263 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
| 264 | * valid UUID with the exception that zero UUID is not supported (
|
---|
| 265 | * 00000000-0000-0000-0000-000000000000).
|
---|
| 266 | * @return Operation
|
---|
| 267 | * @throws \Google\Service\Exception
|
---|
| 268 | */
|
---|
| 269 | public function patch($project, $image, Image $postBody, $optParams = [])
|
---|
| 270 | {
|
---|
| 271 | $params = ['project' => $project, 'image' => $image, 'postBody' => $postBody];
|
---|
| 272 | $params = array_merge($params, $optParams);
|
---|
| 273 | return $this->call('patch', [$params], Operation::class);
|
---|
| 274 | }
|
---|
| 275 | /**
|
---|
| 276 | * Sets the access control policy on the specified resource. Replaces any
|
---|
| 277 | * existing policy. (images.setIamPolicy)
|
---|
| 278 | *
|
---|
| 279 | * @param string $project Project ID for this request.
|
---|
| 280 | * @param string $resource Name or id of the resource for this request.
|
---|
| 281 | * @param GlobalSetPolicyRequest $postBody
|
---|
| 282 | * @param array $optParams Optional parameters.
|
---|
| 283 | * @return Policy
|
---|
| 284 | * @throws \Google\Service\Exception
|
---|
| 285 | */
|
---|
| 286 | public function setIamPolicy($project, $resource, GlobalSetPolicyRequest $postBody, $optParams = [])
|
---|
| 287 | {
|
---|
| 288 | $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
|
---|
| 289 | $params = array_merge($params, $optParams);
|
---|
| 290 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 291 | }
|
---|
| 292 | /**
|
---|
| 293 | * Sets the labels on an image. To learn more about labels, read the Labeling
|
---|
| 294 | * Resources documentation. (images.setLabels)
|
---|
| 295 | *
|
---|
| 296 | * @param string $project Project ID for this request.
|
---|
| 297 | * @param string $resource Name or id of the resource for this request.
|
---|
| 298 | * @param GlobalSetLabelsRequest $postBody
|
---|
| 299 | * @param array $optParams Optional parameters.
|
---|
| 300 | * @return Operation
|
---|
| 301 | * @throws \Google\Service\Exception
|
---|
| 302 | */
|
---|
| 303 | public function setLabels($project, $resource, GlobalSetLabelsRequest $postBody, $optParams = [])
|
---|
| 304 | {
|
---|
| 305 | $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
|
---|
| 306 | $params = array_merge($params, $optParams);
|
---|
| 307 | return $this->call('setLabels', [$params], Operation::class);
|
---|
| 308 | }
|
---|
| 309 | /**
|
---|
| 310 | * Returns permissions that a caller has on the specified resource.
|
---|
| 311 | * (images.testIamPermissions)
|
---|
| 312 | *
|
---|
| 313 | * @param string $project Project ID for this request.
|
---|
| 314 | * @param string $resource Name or id of the resource for this request.
|
---|
| 315 | * @param TestPermissionsRequest $postBody
|
---|
| 316 | * @param array $optParams Optional parameters.
|
---|
| 317 | * @return TestPermissionsResponse
|
---|
| 318 | * @throws \Google\Service\Exception
|
---|
| 319 | */
|
---|
| 320 | public function testIamPermissions($project, $resource, TestPermissionsRequest $postBody, $optParams = [])
|
---|
| 321 | {
|
---|
| 322 | $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
|
---|
| 323 | $params = array_merge($params, $optParams);
|
---|
| 324 | return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class);
|
---|
| 325 | }
|
---|
| 326 | }
|
---|
| 327 |
|
---|
| 328 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 329 | class_alias(Images::class, 'Google_Service_Compute_Resource_Images');
|
---|