api/cloud_storage/CloudStorageTools.php
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
\google\appengine\api\cloud_storage\CloudStorageTools
Constants
Properties

$send_header = nullIf set, then $send_header is expected to be a closure that accepts a key, value pair where key is the header name, and value is the header value.
nullDetails- Type
- n/a
Methods

createUploadUrl(string $success_path, mixed[] $options = array()) : stringCreate an absolute URL that can be used by a user to asynchronously upload a large blob.
Upon completion of the upload, a callback is made to the specified URL.
| Name | Type | Description |
|---|---|---|
| $success_path | string | A relative URL which will be invoked after the user successfully uploads a blob. |
| $options | mixed[] | A key value pair array of upload options. Valid options are:
|
| Type | Description |
|---|---|
| string | The upload URL. |
| Exception | Description |
|---|---|
| \InvalidArgumentException | If $success_path is not valid, or one of the options is not valid. |
| \google\appengine\api\cloud_storage\CloudStorageException | Thrown when there is a failure using the blobstore service. |

deleteImageServingUrl(string $gs_filename) : voidDeletes an image serving URL that was created using getImageServingUrl.
| Name | Type | Description |
|---|---|---|
| $gs_filename | string | The name of the Google Cloud Storage object that has an existing URL to delete. In the format gs://bucket_name/object_name |
| Exception | Description |
|---|---|
| \InvalidArgumentException | if any of the arguments are not valid. |
| \google\appengine\api\cloud_storage\CloudStorageException | If there was a problem contacting the service. |

getDefaultGoogleStorageBucketName() : stringReturn the name of the default Google Cloud Storage bucket for the application, if one has been configured.
| Type | Description |
|---|---|
| string | The bucket name, or an empty string if no bucket has been configured. |

getImageServingUrl(string $gs_filename, mixed[] $options = array()) : stringReturns a URL that serves an image.
| Name | Type | Description |
|---|---|---|
| $gs_filename | string | The name of the Google Cloud Storage object to serve. In the format gs://bucket_name/object_name |
| $options | mixed[] | Array of additional options for serving the object. Valid options are:
|
| Type | Description |
|---|---|
| string | The image serving URL. |
| Exception | Description |
|---|---|
| \InvalidArgumentException | if any of the arguments are not valid. |
| \google\appengine\api\cloud_storage\CloudStorageException | If there was a problem contacting the service. |

serve(string $gs_filename, mixed[] $options = array()) : voidServe a Google Cloud Storage file as the response.
| Name | Type | Description |
|---|---|---|
| $gs_filename | string | The name of the Google Cloud Storage object to serve. |
| $options | mixed[] | Array of additional options for serving the object.
|
| Exception | Description |
|---|---|
| \InvalidArgumentException | If invalid options are supplied. |

setSendHeaderFunction(mixed $new_header_func) : voidThis function is used for unit testing only, it allows replacement of the send_header function that is used to set headers on the response.
| Name | Type | Description |
|---|---|---|
| $new_header_func | mixed | The function to use to set response headers. Set to null to use the inbuilt PHP method header(). |