| 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\Storage\Resource; |
| 19 |
|
| 20 |
use Google\Service\Storage\Channel; |
| 21 |
use Google\Service\Storage\ComposeRequest; |
| 22 |
use Google\Service\Storage\Objects as ObjectsModel; |
| 23 |
use Google\Service\Storage\Policy; |
| 24 |
use Google\Service\Storage\RewriteResponse; |
| 25 |
use Google\Service\Storage\StorageObject; |
| 26 |
use Google\Service\Storage\TestIamPermissionsResponse; |
| 27 |
|
| 28 |
/** |
| 29 |
* The "objects" collection of methods. |
| 30 |
* Typical usage is: |
| 31 |
* <code> |
| 32 |
* $storageService = new Google\Service\Storage(...); |
| 33 |
* $objects = $storageService->objects; |
| 34 |
* </code> |
| 35 |
*/ |
| 36 |
class Objects extends \Google\Service\Resource |
| 37 |
{ |
| 38 |
/** |
| 39 |
* Concatenates a list of existing objects into a new object in the same bucket. |
| 40 |
* (objects.compose) |
| 41 |
* |
| 42 |
* @param string $destinationBucket Name of the bucket containing the source |
| 43 |
* objects. The destination object is stored in this bucket. |
| 44 |
* @param string $destinationObject Name of the new object. For information |
| 45 |
* about how to URL encode object names to be path safe, see Encoding URI Path |
| 46 |
* Parts. |
| 47 |
* @param ComposeRequest $postBody |
| 48 |
* @param array $optParams Optional parameters. |
| 49 |
* |
| 50 |
* @opt_param string destinationPredefinedAcl Apply a predefined set of access |
| 51 |
* controls to the destination object. |
| 52 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 53 |
* whether the object's current generation matches the given value. Setting to 0 |
| 54 |
* makes the operation succeed only if there are no live versions of the object. |
| 55 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 56 |
* whether the object's current metageneration matches the given value. |
| 57 |
* @opt_param string kmsKeyName Resource name of the Cloud KMS key, of the form |
| 58 |
* projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that |
| 59 |
* will be used to encrypt the object. Overrides the object metadata's |
| 60 |
* kms_key_name value, if any. |
| 61 |
* @opt_param string userProject The project to be billed for this request. |
| 62 |
* Required for Requester Pays buckets. |
| 63 |
* @return StorageObject |
| 64 |
*/ |
| 65 |
public function compose($destinationBucket, $destinationObject, ComposeRequest $postBody, $optParams = []) |
| 66 |
{ |
| 67 |
$params = ['destinationBucket' => $destinationBucket, 'destinationObject' => $destinationObject, 'postBody' => $postBody]; |
| 68 |
$params = array_merge($params, $optParams); |
| 69 |
return $this->call('compose', [$params], StorageObject::class); |
| 70 |
} |
| 71 |
/** |
| 72 |
* Copies a source object to a destination object. Optionally overrides |
| 73 |
* metadata. (objects.copy) |
| 74 |
* |
| 75 |
* @param string $sourceBucket Name of the bucket in which to find the source |
| 76 |
* object. |
| 77 |
* @param string $sourceObject Name of the source object. For information about |
| 78 |
* how to URL encode object names to be path safe, see Encoding URI Path Parts. |
| 79 |
* @param string $destinationBucket Name of the bucket in which to store the new |
| 80 |
* object. Overrides the provided object metadata's bucket value, if any.For |
| 81 |
* information about how to URL encode object names to be path safe, see |
| 82 |
* Encoding URI Path Parts. |
| 83 |
* @param string $destinationObject Name of the new object. Required when the |
| 84 |
* object metadata is not otherwise provided. Overrides the object metadata's |
| 85 |
* name value, if any. |
| 86 |
* @param StorageObject $postBody |
| 87 |
* @param array $optParams Optional parameters. |
| 88 |
* |
| 89 |
* @opt_param string destinationKmsKeyName Resource name of the Cloud KMS key, |
| 90 |
* of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys |
| 91 |
* /my-key, that will be used to encrypt the object. Overrides the object |
| 92 |
* metadata's kms_key_name value, if any. |
| 93 |
* @opt_param string destinationPredefinedAcl Apply a predefined set of access |
| 94 |
* controls to the destination object. |
| 95 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 96 |
* whether the destination object's current generation matches the given value. |
| 97 |
* Setting to 0 makes the operation succeed only if there are no live versions |
| 98 |
* of the object. |
| 99 |
* @opt_param string ifGenerationNotMatch Makes the operation conditional on |
| 100 |
* whether the destination object's current generation does not match the given |
| 101 |
* value. If no live object exists, the precondition fails. Setting to 0 makes |
| 102 |
* the operation succeed only if there is a live version of the object. |
| 103 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 104 |
* whether the destination object's current metageneration matches the given |
| 105 |
* value. |
| 106 |
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on |
| 107 |
* whether the destination object's current metageneration does not match the |
| 108 |
* given value. |
| 109 |
* @opt_param string ifSourceGenerationMatch Makes the operation conditional on |
| 110 |
* whether the source object's current generation matches the given value. |
| 111 |
* @opt_param string ifSourceGenerationNotMatch Makes the operation conditional |
| 112 |
* on whether the source object's current generation does not match the given |
| 113 |
* value. |
| 114 |
* @opt_param string ifSourceMetagenerationMatch Makes the operation conditional |
| 115 |
* on whether the source object's current metageneration matches the given |
| 116 |
* value. |
| 117 |
* @opt_param string ifSourceMetagenerationNotMatch Makes the operation |
| 118 |
* conditional on whether the source object's current metageneration does not |
| 119 |
* match the given value. |
| 120 |
* @opt_param string projection Set of properties to return. Defaults to noAcl, |
| 121 |
* unless the object resource specifies the acl property, when it defaults to |
| 122 |
* full. |
| 123 |
* @opt_param string sourceGeneration If present, selects a specific revision of |
| 124 |
* the source object (as opposed to the latest version, the default). |
| 125 |
* @opt_param string userProject The project to be billed for this request. |
| 126 |
* Required for Requester Pays buckets. |
| 127 |
* @return StorageObject |
| 128 |
*/ |
| 129 |
public function copy($sourceBucket, $sourceObject, $destinationBucket, $destinationObject, StorageObject $postBody, $optParams = []) |
| 130 |
{ |
| 131 |
$params = ['sourceBucket' => $sourceBucket, 'sourceObject' => $sourceObject, 'destinationBucket' => $destinationBucket, 'destinationObject' => $destinationObject, 'postBody' => $postBody]; |
| 132 |
$params = array_merge($params, $optParams); |
| 133 |
return $this->call('copy', [$params], StorageObject::class); |
| 134 |
} |
| 135 |
/** |
| 136 |
* Deletes an object and its metadata. Deletions are permanent if versioning is |
| 137 |
* not enabled for the bucket, or if the generation parameter is used. |
| 138 |
* (objects.delete) |
| 139 |
* |
| 140 |
* @param string $bucket Name of the bucket in which the object resides. |
| 141 |
* @param string $object Name of the object. For information about how to URL |
| 142 |
* encode object names to be path safe, see Encoding URI Path Parts. |
| 143 |
* @param array $optParams Optional parameters. |
| 144 |
* |
| 145 |
* @opt_param string generation If present, permanently deletes a specific |
| 146 |
* revision of this object (as opposed to the latest version, the default). |
| 147 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 148 |
* whether the object's current generation matches the given value. Setting to 0 |
| 149 |
* makes the operation succeed only if there are no live versions of the object. |
| 150 |
* @opt_param string ifGenerationNotMatch Makes the operation conditional on |
| 151 |
* whether the object's current generation does not match the given value. If no |
| 152 |
* live object exists, the precondition fails. Setting to 0 makes the operation |
| 153 |
* succeed only if there is a live version of the object. |
| 154 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 155 |
* whether the object's current metageneration matches the given value. |
| 156 |
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on |
| 157 |
* whether the object's current metageneration does not match the given value. |
| 158 |
* @opt_param string userProject The project to be billed for this request. |
| 159 |
* Required for Requester Pays buckets. |
| 160 |
*/ |
| 161 |
public function delete($bucket, $object, $optParams = []) |
| 162 |
{ |
| 163 |
$params = ['bucket' => $bucket, 'object' => $object]; |
| 164 |
$params = array_merge($params, $optParams); |
| 165 |
return $this->call('delete', [$params]); |
| 166 |
} |
| 167 |
/** |
| 168 |
* Retrieves an object or its metadata. (objects.get) |
| 169 |
* |
| 170 |
* @param string $bucket Name of the bucket in which the object resides. |
| 171 |
* @param string $object Name of the object. For information about how to URL |
| 172 |
* encode object names to be path safe, see Encoding URI Path Parts. |
| 173 |
* @param array $optParams Optional parameters. |
| 174 |
* |
| 175 |
* @opt_param string generation If present, selects a specific revision of this |
| 176 |
* object (as opposed to the latest version, the default). |
| 177 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 178 |
* whether the object's current generation matches the given value. Setting to 0 |
| 179 |
* makes the operation succeed only if there are no live versions of the object. |
| 180 |
* @opt_param string ifGenerationNotMatch Makes the operation conditional on |
| 181 |
* whether the object's current generation does not match the given value. If no |
| 182 |
* live object exists, the precondition fails. Setting to 0 makes the operation |
| 183 |
* succeed only if there is a live version of the object. |
| 184 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 185 |
* whether the object's current metageneration matches the given value. |
| 186 |
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on |
| 187 |
* whether the object's current metageneration does not match the given value. |
| 188 |
* @opt_param string projection Set of properties to return. Defaults to noAcl. |
| 189 |
* @opt_param string userProject The project to be billed for this request. |
| 190 |
* Required for Requester Pays buckets. |
| 191 |
* @return StorageObject |
| 192 |
*/ |
| 193 |
public function get($bucket, $object, $optParams = []) |
| 194 |
{ |
| 195 |
$params = ['bucket' => $bucket, 'object' => $object]; |
| 196 |
$params = array_merge($params, $optParams); |
| 197 |
return $this->call('get', [$params], StorageObject::class); |
| 198 |
} |
| 199 |
/** |
| 200 |
* Returns an IAM policy for the specified object. (objects.getIamPolicy) |
| 201 |
* |
| 202 |
* @param string $bucket Name of the bucket in which the object resides. |
| 203 |
* @param string $object Name of the object. For information about how to URL |
| 204 |
* encode object names to be path safe, see Encoding URI Path Parts. |
| 205 |
* @param array $optParams Optional parameters. |
| 206 |
* |
| 207 |
* @opt_param string generation If present, selects a specific revision of this |
| 208 |
* object (as opposed to the latest version, the default). |
| 209 |
* @opt_param string userProject The project to be billed for this request. |
| 210 |
* Required for Requester Pays buckets. |
| 211 |
* @return Policy |
| 212 |
*/ |
| 213 |
public function getIamPolicy($bucket, $object, $optParams = []) |
| 214 |
{ |
| 215 |
$params = ['bucket' => $bucket, 'object' => $object]; |
| 216 |
$params = array_merge($params, $optParams); |
| 217 |
return $this->call('getIamPolicy', [$params], Policy::class); |
| 218 |
} |
| 219 |
/** |
| 220 |
* Stores a new object and metadata. (objects.insert) |
| 221 |
* |
| 222 |
* @param string $bucket Name of the bucket in which to store the new object. |
| 223 |
* Overrides the provided object metadata's bucket value, if any. |
| 224 |
* @param StorageObject $postBody |
| 225 |
* @param array $optParams Optional parameters. |
| 226 |
* |
| 227 |
* @opt_param string contentEncoding If set, sets the contentEncoding property |
| 228 |
* of the final object to this value. Setting this parameter is equivalent to |
| 229 |
* setting the contentEncoding metadata property. This can be useful when |
| 230 |
* uploading an object with uploadType=media to indicate the encoding of the |
| 231 |
* content being uploaded. |
| 232 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 233 |
* whether the object's current generation matches the given value. Setting to 0 |
| 234 |
* makes the operation succeed only if there are no live versions of the object. |
| 235 |
* @opt_param string ifGenerationNotMatch Makes the operation conditional on |
| 236 |
* whether the object's current generation does not match the given value. If no |
| 237 |
* live object exists, the precondition fails. Setting to 0 makes the operation |
| 238 |
* succeed only if there is a live version of the object. |
| 239 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 240 |
* whether the object's current metageneration matches the given value. |
| 241 |
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on |
| 242 |
* whether the object's current metageneration does not match the given value. |
| 243 |
* @opt_param string kmsKeyName Resource name of the Cloud KMS key, of the form |
| 244 |
* projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that |
| 245 |
* will be used to encrypt the object. Overrides the object metadata's |
| 246 |
* kms_key_name value, if any. |
| 247 |
* @opt_param string name Name of the object. Required when the object metadata |
| 248 |
* is not otherwise provided. Overrides the object metadata's name value, if |
| 249 |
* any. For information about how to URL encode object names to be path safe, |
| 250 |
* see Encoding URI Path Parts. |
| 251 |
* @opt_param string predefinedAcl Apply a predefined set of access controls to |
| 252 |
* this object. |
| 253 |
* @opt_param string projection Set of properties to return. Defaults to noAcl, |
| 254 |
* unless the object resource specifies the acl property, when it defaults to |
| 255 |
* full. |
| 256 |
* @opt_param string userProject The project to be billed for this request. |
| 257 |
* Required for Requester Pays buckets. |
| 258 |
* @return StorageObject |
| 259 |
*/ |
| 260 |
public function insert($bucket, StorageObject $postBody, $optParams = []) |
| 261 |
{ |
| 262 |
$params = ['bucket' => $bucket, 'postBody' => $postBody]; |
| 263 |
$params = array_merge($params, $optParams); |
| 264 |
return $this->call('insert', [$params], StorageObject::class); |
| 265 |
} |
| 266 |
/** |
| 267 |
* Retrieves a list of objects matching the criteria. (objects.listObjects) |
| 268 |
* |
| 269 |
* @param string $bucket Name of the bucket in which to look for objects. |
| 270 |
* @param array $optParams Optional parameters. |
| 271 |
* |
| 272 |
* @opt_param string delimiter Returns results in a directory-like mode. items |
| 273 |
* will contain only objects whose names, aside from the prefix, do not contain |
| 274 |
* delimiter. Objects whose names, aside from the prefix, contain delimiter will |
| 275 |
* have their name, truncated after the delimiter, returned in prefixes. |
| 276 |
* Duplicate prefixes are omitted. |
| 277 |
* @opt_param string endOffset Filter results to objects whose names are |
| 278 |
* lexicographically before endOffset. If startOffset is also set, the objects |
| 279 |
* listed will have names between startOffset (inclusive) and endOffset |
| 280 |
* (exclusive). |
| 281 |
* @opt_param bool includeTrailingDelimiter If true, objects that end in exactly |
| 282 |
* one instance of delimiter will have their metadata included in items in |
| 283 |
* addition to prefixes. |
| 284 |
* @opt_param string maxResults Maximum number of items plus prefixes to return |
| 285 |
* in a single page of responses. As duplicate prefixes are omitted, fewer total |
| 286 |
* results may be returned than requested. The service will use this parameter |
| 287 |
* or 1,000 items, whichever is smaller. |
| 288 |
* @opt_param string pageToken A previously-returned page token representing |
| 289 |
* part of the larger set of results to view. |
| 290 |
* @opt_param string prefix Filter results to objects whose names begin with |
| 291 |
* this prefix. |
| 292 |
* @opt_param string projection Set of properties to return. Defaults to noAcl. |
| 293 |
* @opt_param string startOffset Filter results to objects whose names are |
| 294 |
* lexicographically equal to or after startOffset. If endOffset is also set, |
| 295 |
* the objects listed will have names between startOffset (inclusive) and |
| 296 |
* endOffset (exclusive). |
| 297 |
* @opt_param string userProject The project to be billed for this request. |
| 298 |
* Required for Requester Pays buckets. |
| 299 |
* @opt_param bool versions If true, lists all versions of an object as distinct |
| 300 |
* results. The default is false. For more information, see Object Versioning. |
| 301 |
* @return ObjectsModel |
| 302 |
*/ |
| 303 |
public function listObjects($bucket, $optParams = []) |
| 304 |
{ |
| 305 |
$params = ['bucket' => $bucket]; |
| 306 |
$params = array_merge($params, $optParams); |
| 307 |
return $this->call('list', [$params], ObjectsModel::class); |
| 308 |
} |
| 309 |
/** |
| 310 |
* Patches an object's metadata. (objects.patch) |
| 311 |
* |
| 312 |
* @param string $bucket Name of the bucket in which the object resides. |
| 313 |
* @param string $object Name of the object. For information about how to URL |
| 314 |
* encode object names to be path safe, see Encoding URI Path Parts. |
| 315 |
* @param StorageObject $postBody |
| 316 |
* @param array $optParams Optional parameters. |
| 317 |
* |
| 318 |
* @opt_param string generation If present, selects a specific revision of this |
| 319 |
* object (as opposed to the latest version, the default). |
| 320 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 321 |
* whether the object's current generation matches the given value. Setting to 0 |
| 322 |
* makes the operation succeed only if there are no live versions of the object. |
| 323 |
* @opt_param string ifGenerationNotMatch Makes the operation conditional on |
| 324 |
* whether the object's current generation does not match the given value. If no |
| 325 |
* live object exists, the precondition fails. Setting to 0 makes the operation |
| 326 |
* succeed only if there is a live version of the object. |
| 327 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 328 |
* whether the object's current metageneration matches the given value. |
| 329 |
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on |
| 330 |
* whether the object's current metageneration does not match the given value. |
| 331 |
* @opt_param string predefinedAcl Apply a predefined set of access controls to |
| 332 |
* this object. |
| 333 |
* @opt_param string projection Set of properties to return. Defaults to full. |
| 334 |
* @opt_param string userProject The project to be billed for this request, for |
| 335 |
* Requester Pays buckets. |
| 336 |
* @return StorageObject |
| 337 |
*/ |
| 338 |
public function patch($bucket, $object, StorageObject $postBody, $optParams = []) |
| 339 |
{ |
| 340 |
$params = ['bucket' => $bucket, 'object' => $object, 'postBody' => $postBody]; |
| 341 |
$params = array_merge($params, $optParams); |
| 342 |
return $this->call('patch', [$params], StorageObject::class); |
| 343 |
} |
| 344 |
/** |
| 345 |
* Rewrites a source object to a destination object. Optionally overrides |
| 346 |
* metadata. (objects.rewrite) |
| 347 |
* |
| 348 |
* @param string $sourceBucket Name of the bucket in which to find the source |
| 349 |
* object. |
| 350 |
* @param string $sourceObject Name of the source object. For information about |
| 351 |
* how to URL encode object names to be path safe, see Encoding URI Path Parts. |
| 352 |
* @param string $destinationBucket Name of the bucket in which to store the new |
| 353 |
* object. Overrides the provided object metadata's bucket value, if any. |
| 354 |
* @param string $destinationObject Name of the new object. Required when the |
| 355 |
* object metadata is not otherwise provided. Overrides the object metadata's |
| 356 |
* name value, if any. For information about how to URL encode object names to |
| 357 |
* be path safe, see Encoding URI Path Parts. |
| 358 |
* @param StorageObject $postBody |
| 359 |
* @param array $optParams Optional parameters. |
| 360 |
* |
| 361 |
* @opt_param string destinationKmsKeyName Resource name of the Cloud KMS key, |
| 362 |
* of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys |
| 363 |
* /my-key, that will be used to encrypt the object. Overrides the object |
| 364 |
* metadata's kms_key_name value, if any. |
| 365 |
* @opt_param string destinationPredefinedAcl Apply a predefined set of access |
| 366 |
* controls to the destination object. |
| 367 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 368 |
* whether the object's current generation matches the given value. Setting to 0 |
| 369 |
* makes the operation succeed only if there are no live versions of the object. |
| 370 |
* @opt_param string ifGenerationNotMatch Makes the operation conditional on |
| 371 |
* whether the object's current generation does not match the given value. If no |
| 372 |
* live object exists, the precondition fails. Setting to 0 makes the operation |
| 373 |
* succeed only if there is a live version of the object. |
| 374 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 375 |
* whether the destination object's current metageneration matches the given |
| 376 |
* value. |
| 377 |
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on |
| 378 |
* whether the destination object's current metageneration does not match the |
| 379 |
* given value. |
| 380 |
* @opt_param string ifSourceGenerationMatch Makes the operation conditional on |
| 381 |
* whether the source object's current generation matches the given value. |
| 382 |
* @opt_param string ifSourceGenerationNotMatch Makes the operation conditional |
| 383 |
* on whether the source object's current generation does not match the given |
| 384 |
* value. |
| 385 |
* @opt_param string ifSourceMetagenerationMatch Makes the operation conditional |
| 386 |
* on whether the source object's current metageneration matches the given |
| 387 |
* value. |
| 388 |
* @opt_param string ifSourceMetagenerationNotMatch Makes the operation |
| 389 |
* conditional on whether the source object's current metageneration does not |
| 390 |
* match the given value. |
| 391 |
* @opt_param string maxBytesRewrittenPerCall The maximum number of bytes that |
| 392 |
* will be rewritten per rewrite request. Most callers shouldn't need to specify |
| 393 |
* this parameter - it is primarily in place to support testing. If specified |
| 394 |
* the value must be an integral multiple of 1 MiB (1048576). Also, this only |
| 395 |
* applies to requests where the source and destination span locations and/or |
| 396 |
* storage classes. Finally, this value must not change across rewrite calls |
| 397 |
* else you'll get an error that the rewriteToken is invalid. |
| 398 |
* @opt_param string projection Set of properties to return. Defaults to noAcl, |
| 399 |
* unless the object resource specifies the acl property, when it defaults to |
| 400 |
* full. |
| 401 |
* @opt_param string rewriteToken Include this field (from the previous rewrite |
| 402 |
* response) on each rewrite request after the first one, until the rewrite |
| 403 |
* response 'done' flag is true. Calls that provide a rewriteToken can omit all |
| 404 |
* other request fields, but if included those fields must match the values |
| 405 |
* provided in the first rewrite request. |
| 406 |
* @opt_param string sourceGeneration If present, selects a specific revision of |
| 407 |
* the source object (as opposed to the latest version, the default). |
| 408 |
* @opt_param string userProject The project to be billed for this request. |
| 409 |
* Required for Requester Pays buckets. |
| 410 |
* @return RewriteResponse |
| 411 |
*/ |
| 412 |
public function rewrite($sourceBucket, $sourceObject, $destinationBucket, $destinationObject, StorageObject $postBody, $optParams = []) |
| 413 |
{ |
| 414 |
$params = ['sourceBucket' => $sourceBucket, 'sourceObject' => $sourceObject, 'destinationBucket' => $destinationBucket, 'destinationObject' => $destinationObject, 'postBody' => $postBody]; |
| 415 |
$params = array_merge($params, $optParams); |
| 416 |
return $this->call('rewrite', [$params], RewriteResponse::class); |
| 417 |
} |
| 418 |
/** |
| 419 |
* Updates an IAM policy for the specified object. (objects.setIamPolicy) |
| 420 |
* |
| 421 |
* @param string $bucket Name of the bucket in which the object resides. |
| 422 |
* @param string $object Name of the object. For information about how to URL |
| 423 |
* encode object names to be path safe, see Encoding URI Path Parts. |
| 424 |
* @param Policy $postBody |
| 425 |
* @param array $optParams Optional parameters. |
| 426 |
* |
| 427 |
* @opt_param string generation If present, selects a specific revision of this |
| 428 |
* object (as opposed to the latest version, the default). |
| 429 |
* @opt_param string userProject The project to be billed for this request. |
| 430 |
* Required for Requester Pays buckets. |
| 431 |
* @return Policy |
| 432 |
*/ |
| 433 |
public function setIamPolicy($bucket, $object, Policy $postBody, $optParams = []) |
| 434 |
{ |
| 435 |
$params = ['bucket' => $bucket, 'object' => $object, 'postBody' => $postBody]; |
| 436 |
$params = array_merge($params, $optParams); |
| 437 |
return $this->call('setIamPolicy', [$params], Policy::class); |
| 438 |
} |
| 439 |
/** |
| 440 |
* Tests a set of permissions on the given object to see which, if any, are held |
| 441 |
* by the caller. (objects.testIamPermissions) |
| 442 |
* |
| 443 |
* @param string $bucket Name of the bucket in which the object resides. |
| 444 |
* @param string $object Name of the object. For information about how to URL |
| 445 |
* encode object names to be path safe, see Encoding URI Path Parts. |
| 446 |
* @param string|array $permissions Permissions to test. |
| 447 |
* @param array $optParams Optional parameters. |
| 448 |
* |
| 449 |
* @opt_param string generation If present, selects a specific revision of this |
| 450 |
* object (as opposed to the latest version, the default). |
| 451 |
* @opt_param string userProject The project to be billed for this request. |
| 452 |
* Required for Requester Pays buckets. |
| 453 |
* @return TestIamPermissionsResponse |
| 454 |
*/ |
| 455 |
public function testIamPermissions($bucket, $object, $permissions, $optParams = []) |
| 456 |
{ |
| 457 |
$params = ['bucket' => $bucket, 'object' => $object, 'permissions' => $permissions]; |
| 458 |
$params = array_merge($params, $optParams); |
| 459 |
return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); |
| 460 |
} |
| 461 |
/** |
| 462 |
* Updates an object's metadata. (objects.update) |
| 463 |
* |
| 464 |
* @param string $bucket Name of the bucket in which the object resides. |
| 465 |
* @param string $object Name of the object. For information about how to URL |
| 466 |
* encode object names to be path safe, see Encoding URI Path Parts. |
| 467 |
* @param StorageObject $postBody |
| 468 |
* @param array $optParams Optional parameters. |
| 469 |
* |
| 470 |
* @opt_param string generation If present, selects a specific revision of this |
| 471 |
* object (as opposed to the latest version, the default). |
| 472 |
* @opt_param string ifGenerationMatch Makes the operation conditional on |
| 473 |
* whether the object's current generation matches the given value. Setting to 0 |
| 474 |
* makes the operation succeed only if there are no live versions of the object. |
| 475 |
* @opt_param string ifGenerationNotMatch Makes the operation conditional on |
| 476 |
* whether the object's current generation does not match the given value. If no |
| 477 |
* live object exists, the precondition fails. Setting to 0 makes the operation |
| 478 |
* succeed only if there is a live version of the object. |
| 479 |
* @opt_param string ifMetagenerationMatch Makes the operation conditional on |
| 480 |
* whether the object's current metageneration matches the given value. |
| 481 |
* @opt_param string ifMetagenerationNotMatch Makes the operation conditional on |
| 482 |
* whether the object's current metageneration does not match the given value. |
| 483 |
* @opt_param string predefinedAcl Apply a predefined set of access controls to |
| 484 |
* this object. |
| 485 |
* @opt_param string projection Set of properties to return. Defaults to full. |
| 486 |
* @opt_param string userProject The project to be billed for this request. |
| 487 |
* Required for Requester Pays buckets. |
| 488 |
* @return StorageObject |
| 489 |
*/ |
| 490 |
public function update($bucket, $object, StorageObject $postBody, $optParams = []) |
| 491 |
{ |
| 492 |
$params = ['bucket' => $bucket, 'object' => $object, 'postBody' => $postBody]; |
| 493 |
$params = array_merge($params, $optParams); |
| 494 |
return $this->call('update', [$params], StorageObject::class); |
| 495 |
} |
| 496 |
/** |
| 497 |
* Watch for changes on all objects in a bucket. (objects.watchAll) |
| 498 |
* |
| 499 |
* @param string $bucket Name of the bucket in which to look for objects. |
| 500 |
* @param Channel $postBody |
| 501 |
* @param array $optParams Optional parameters. |
| 502 |
* |
| 503 |
* @opt_param string delimiter Returns results in a directory-like mode. items |
| 504 |
* will contain only objects whose names, aside from the prefix, do not contain |
| 505 |
* delimiter. Objects whose names, aside from the prefix, contain delimiter will |
| 506 |
* have their name, truncated after the delimiter, returned in prefixes. |
| 507 |
* Duplicate prefixes are omitted. |
| 508 |
* @opt_param string endOffset Filter results to objects whose names are |
| 509 |
* lexicographically before endOffset. If startOffset is also set, the objects |
| 510 |
* listed will have names between startOffset (inclusive) and endOffset |
| 511 |
* (exclusive). |
| 512 |
* @opt_param bool includeTrailingDelimiter If true, objects that end in exactly |
| 513 |
* one instance of delimiter will have their metadata included in items in |
| 514 |
* addition to prefixes. |
| 515 |
* @opt_param string maxResults Maximum number of items plus prefixes to return |
| 516 |
* in a single page of responses. As duplicate prefixes are omitted, fewer total |
| 517 |
* results may be returned than requested. The service will use this parameter |
| 518 |
* or 1,000 items, whichever is smaller. |
| 519 |
* @opt_param string pageToken A previously-returned page token representing |
| 520 |
* part of the larger set of results to view. |
| 521 |
* @opt_param string prefix Filter results to objects whose names begin with |
| 522 |
* this prefix. |
| 523 |
* @opt_param string projection Set of properties to return. Defaults to noAcl. |
| 524 |
* @opt_param string startOffset Filter results to objects whose names are |
| 525 |
* lexicographically equal to or after startOffset. If endOffset is also set, |
| 526 |
* the objects listed will have names between startOffset (inclusive) and |
| 527 |
* endOffset (exclusive). |
| 528 |
* @opt_param string userProject The project to be billed for this request. |
| 529 |
* Required for Requester Pays buckets. |
| 530 |
* @opt_param bool versions If true, lists all versions of an object as distinct |
| 531 |
* results. The default is false. For more information, see Object Versioning. |
| 532 |
* @return Channel |
| 533 |
*/ |
| 534 |
public function watchAll($bucket, Channel $postBody, $optParams = []) |
| 535 |
{ |
| 536 |
$params = ['bucket' => $bucket, 'postBody' => $postBody]; |
| 537 |
$params = array_merge($params, $optParams); |
| 538 |
return $this->call('watchAll', [$params], Channel::class); |
| 539 |
} |
| 540 |
} |
| 541 |
|
| 542 |
// Adding a class alias for backwards compatibility with the previous class name. |
| 543 |
class_alias(Objects::class, 'Google_Service_Storage_Resource_Objects'); |
| 544 |
|