class Objects extends Resource (View source)

The "objects" collection of methods.

Typical usage is:

 $storageService = new Google\Service\Storage(...);
 $objects = $storageService->objects;

Methods

bulkRestore(string $bucket, BulkRestoreObjectsRequest $postBody, array $optParams = [])

Initiates a long-running bulk restore operation on the specified bucket.

compose(string $destinationBucket, string $destinationObject, ComposeRequest $postBody, array $optParams = [])

Concatenates a list of existing objects into a new object in the same bucket.

copy(string $sourceBucket, string $sourceObject, string $destinationBucket, string $destinationObject, StorageObject $postBody, array $optParams = [])

Copies a source object to a destination object. Optionally overrides metadata. (objects.copy)

delete(string $bucket, string $object, array $optParams = [])

Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.

get(string $bucket, string $object, array $optParams = [])

Retrieves an object or its metadata. (objects.get)

getIamPolicy(string $bucket, string $object, array $optParams = [])

Returns an IAM policy for the specified object. (objects.getIamPolicy)

insert(string $bucket, StorageObject $postBody, array $optParams = [])

Stores a new object and metadata. (objects.insert)

listObjects(string $bucket, array $optParams = [])

Retrieves a list of objects matching the criteria. (objects.listObjects)

patch(string $bucket, string $object, StorageObject $postBody, array $optParams = [])

Patches an object's metadata. (objects.patch)

restore(string $bucket, string $object, string $generation, array $optParams = [])

Restores a soft-deleted object. (objects.restore)

rewrite(string $sourceBucket, string $sourceObject, string $destinationBucket, string $destinationObject, StorageObject $postBody, array $optParams = [])

Rewrites a source object to a destination object. Optionally overrides metadata. (objects.rewrite)

setIamPolicy(string $bucket, string $object, Policy $postBody, array $optParams = [])

Updates an IAM policy for the specified object. (objects.setIamPolicy)

testIamPermissions(string $bucket, string $object, string|array $permissions, array $optParams = [])

Tests a set of permissions on the given object to see which, if any, are held by the caller. (objects.testIamPermissions)

update(string $bucket, string $object, StorageObject $postBody, array $optParams = [])

Updates an object's metadata. (objects.update)

watchAll(string $bucket, Channel $postBody, array $optParams = [])

Watch for changes on all objects in a bucket. (objects.watchAll)

Details

GoogleLongrunningOperation bulkRestore(string $bucket, BulkRestoreObjectsRequest $postBody, array $optParams = [])

Initiates a long-running bulk restore operation on the specified bucket.

(objects.bulkRestore)

Parameters

string $bucket

Name of the bucket in which the object resides.

BulkRestoreObjectsRequest $postBody
array $optParams

Optional parameters.

Return Value

GoogleLongrunningOperation

Exceptions

Exception

StorageObject compose(string $destinationBucket, string $destinationObject, ComposeRequest $postBody, array $optParams = [])

Concatenates a list of existing objects into a new object in the same bucket.

(objects.compose)

Parameters

string $destinationBucket

Name of the bucket containing the source objects. The destination object is stored in this bucket.

string $destinationObject

Name of the new object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

ComposeRequest $postBody
array $optParams

Optional parameters.

Return Value

StorageObject

Exceptions

Exception

StorageObject copy(string $sourceBucket, string $sourceObject, string $destinationBucket, string $destinationObject, StorageObject $postBody, array $optParams = [])

Copies a source object to a destination object. Optionally overrides metadata. (objects.copy)

Parameters

string $sourceBucket

Name of the bucket in which to find the source object.

string $sourceObject

Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

string $destinationBucket

Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

string $destinationObject

Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any.

StorageObject $postBody
array $optParams

Optional parameters.

Return Value

StorageObject

Exceptions

Exception

delete(string $bucket, string $object, array $optParams = [])

Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.

(objects.delete)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

array $optParams

Optional parameters.

Exceptions

Exception

StorageObject get(string $bucket, string $object, array $optParams = [])

Retrieves an object or its metadata. (objects.get)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

array $optParams

Optional parameters.

Return Value

StorageObject

Exceptions

Exception

Policy getIamPolicy(string $bucket, string $object, array $optParams = [])

Returns an IAM policy for the specified object. (objects.getIamPolicy)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

StorageObject insert(string $bucket, StorageObject $postBody, array $optParams = [])

Stores a new object and metadata. (objects.insert)

Parameters

string $bucket

Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.

StorageObject $postBody
array $optParams

Optional parameters.

Return Value

StorageObject

Exceptions

Exception

Objects listObjects(string $bucket, array $optParams = [])

Retrieves a list of objects matching the criteria. (objects.listObjects)

Parameters

string $bucket

Name of the bucket in which to look for objects.

array $optParams

Optional parameters.

Return Value

Objects

Exceptions

Exception

StorageObject patch(string $bucket, string $object, StorageObject $postBody, array $optParams = [])

Patches an object's metadata. (objects.patch)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

StorageObject $postBody
array $optParams

Optional parameters.

Return Value

StorageObject

Exceptions

Exception

StorageObject restore(string $bucket, string $object, string $generation, array $optParams = [])

Restores a soft-deleted object. (objects.restore)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

string $generation

Selects a specific revision of this object.

array $optParams

Optional parameters.

Return Value

StorageObject

Exceptions

Exception

RewriteResponse rewrite(string $sourceBucket, string $sourceObject, string $destinationBucket, string $destinationObject, StorageObject $postBody, array $optParams = [])

Rewrites a source object to a destination object. Optionally overrides metadata. (objects.rewrite)

Parameters

string $sourceBucket

Name of the bucket in which to find the source object.

string $sourceObject

Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

string $destinationBucket

Name of the bucket in which to store the new object. Overrides the provided object metadata's bucket value, if any.

string $destinationObject

Name of the new object. Required when the object metadata is not otherwise provided. Overrides the object metadata's name value, if any. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

StorageObject $postBody
array $optParams

Optional parameters.

Return Value

RewriteResponse

Exceptions

Exception

Policy setIamPolicy(string $bucket, string $object, Policy $postBody, array $optParams = [])

Updates an IAM policy for the specified object. (objects.setIamPolicy)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

Policy $postBody
array $optParams

Optional parameters.

Return Value

Policy

Exceptions

Exception

TestIamPermissionsResponse testIamPermissions(string $bucket, string $object, string|array $permissions, array $optParams = [])

Tests a set of permissions on the given object to see which, if any, are held by the caller. (objects.testIamPermissions)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

string|array $permissions

Permissions to test.

array $optParams

Optional parameters.

Return Value

TestIamPermissionsResponse

Exceptions

Exception

StorageObject update(string $bucket, string $object, StorageObject $postBody, array $optParams = [])

Updates an object's metadata. (objects.update)

Parameters

string $bucket

Name of the bucket in which the object resides.

string $object

Name of the object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

StorageObject $postBody
array $optParams

Optional parameters.

Return Value

StorageObject

Exceptions

Exception

Channel watchAll(string $bucket, Channel $postBody, array $optParams = [])

Watch for changes on all objects in a bucket. (objects.watchAll)

Parameters

string $bucket

Name of the bucket in which to look for objects.

Channel $postBody
array $optParams

Optional parameters.

Return Value

Channel

Exceptions

Exception