|
const | GS_PREFIX = 'gs://' |
|
const | BLOB_KEY_HEADER = "X-AppEngine-BlobKey" |
|
const | BLOB_RANGE_HEADER = "X-AppEngine-BlobRange" |
|
const | MAX_IMAGE_SERVING_SIZE = 1600 |
|
const | LOCAL_ENDPOINT = "/_ah/gcs" |
|
const | PRODUCTION_HOST_SUBDOMAIN_FORMAT = "%s.storage.googleapis.com" |
|
const | PRODUCTION_HOST_PATH_FORMAT = "storage.googleapis.com" |
|
const | GS_FILENAME_FORMAT = "gs://%s/%s" |
|
CloudStorageTools allows the user to create and serve data with Google Cloud Storage .
static static google\appengine\api\cloud_storage\CloudStorageTools::createUploadUrl |
( |
|
$success_path, |
|
|
|
$options = array() |
|
) |
| |
|
static |
Create 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.
- Parameters
-
string | $success_path | A relative URL which will be invoked after the user successfully uploads a blob. |
| mixed[] | $options A key value pair array of upload options. Valid options are:
-
'max_bytes_per_blob': integer The value of the largest size that any one uploaded blob may be. Default value: unlimited.
-
'max_bytes_total': integer The value that is the total size that sum of all uploaded blobs may be. Default value: unlimited.
-
'gs_bucket_name': string The name of a Google Cloud Storage bucket that the blobs should be uploaded to. Not specifying a value will result in the blob being uploaded to the application's default bucket.
|
- Returns
- string The upload URL.
- Exceptions
-
| InvalidArgumentException If $success_path is not valid, or one of the options is not valid. |
CloudStorageException | Thrown when there is a failure using the blobstore service. |
static google\appengine\api\cloud_storage\CloudStorageTools::deleteImageServingUrl |
( |
|
$gs_filename | ) |
|
|
static |
Deletes an image serving URL that was created using getImageServingUrl.
- Parameters
-
string | $gs_filename | The name of the Google Cloud Storage object that has an existing URL to delete. In the format gs://bucket_name/object_name |
- Exceptions
-
| InvalidArgumentException if any of the arguments are not valid. |
CloudStorageException | If there was a problem contacting the service. |
static google\appengine\api\cloud_storage\CloudStorageTools::getContentType |
( |
|
$handle | ) |
|
|
static |
Get content type from a Google Cloud Storage file pointer resource.
- Parameters
-
resource | $handle | A Google Cloud Storage file pointer resource that is typically created using fopen(). |
- Returns
- string The content type of the Google Cloud Storage object.
- Exceptions
-
| InvalidArgumentException If $handler is not a Google Cloud Storage file pointer resource. |
static google\appengine\api\cloud_storage\CloudStorageTools::getDefaultGoogleStorageBucketName |
( |
| ) |
|
|
static |
Return the name of the default Google Cloud Storage bucket for the application, if one has been configured.
- Returns
- string The bucket name, or an empty string if no bucket has been configured.
static google\appengine\api\cloud_storage\CloudStorageTools::getFilename |
( |
|
$bucket, |
|
|
|
$object |
|
) |
| |
|
static |
Get the filename of a Google Cloud Storage object.
- Parameters
-
string | $bucket | The Google Cloud Storage bucket name. |
string | $object | The Google Cloud Stroage object name. |
- Returns
- string The filename in the format gs://bucket_name/object_name.
- Exceptions
-
| InvalidArgumentException if bucket or object name is invalid. |
static google\appengine\api\cloud_storage\CloudStorageTools::getImageServingUrl |
( |
|
$gs_filename, |
|
|
|
$options = [] |
|
) |
| |
|
static |
Returns a URL that serves an image.
- Parameters
-
string | $gs_filename | The name of the Google Cloud Storage object to serve. In the format gs://bucket_name/object_name |
| mixed[] | $options Array of additional options for serving the object. Valid options are:
-
'crop': boolean Whether the image should be cropped. If set to true, a size must also be supplied. Default value: false.
-
'secure_url': boolean Whether to request an https URL. Default value: false.
-
'size': integer The size of the longest dimension of the resulting image. Size must be in the range 0 to 1600, with 0 specifying the size of the original image. The aspect ratio is preserved unless 'crop' is specified.
|
- Returns
- string The image serving URL.
- Exceptions
-
| InvalidArgumentException if any of the arguments are not valid. |
CloudStorageException | If there was a problem contacting the service. |
static google\appengine\api\cloud_storage\CloudStorageTools::getMetaData |
( |
|
$handle | ) |
|
|
static |
Get metadata from a Google Cloud Storage file pointer resource.
- Parameters
-
resource | $handle | A Google Cloud Storage file pointer resource that is typically created using fopen(). |
- Returns
- array An array that maps metadata keys to values.
- Exceptions
-
| InvalidArgumentException If $handler is not a Google Cloud Storage file pointer resource. |
static google\appengine\api\cloud_storage\CloudStorageTools::getPublicUrl |
( |
|
$gs_filename, |
|
|
|
$use_https |
|
) |
| |
|
static |
Get the public URL for a Google Cloud Storage filename.
- Parameters
-
string | $gs_filename | The Google Cloud Storage filename, in the format gs://bucket_name/object_name. |
boolean | $use_https | If True then return a HTTPS URL. Note that the development server ignores this argument and returns only HTTP URLs. |
- Returns
- string The public URL.
- Exceptions
-
| InvalidArgumentException if the filename is not in the correct format or $use_https is not a boolean. |
static google\appengine\api\cloud_storage\CloudStorageTools::parseFilename |
( |
|
$filename, |
|
|
& |
$bucket, |
|
|
& |
$object |
|
) |
| |
|
static |
Parse and extract the bucket and object names from the supplied filename.
- Parameters
-
string | $filename | The filename in the format gs://bucket_name or gs://bucket_name/object_name. |
string | &$bucket | The extracted bucket. |
string | &$object | The extracted bucket. Can be null if the filename contains only bucket name. |
- Returns
- bool true if the filename is successfully parsed, false otherwise.
static google\appengine\api\cloud_storage\CloudStorageTools::serve |
( |
|
$gs_filename, |
|
|
|
$options = [] |
|
) |
| |
|
static |
Serve a Google Cloud Storage file as the response.
- Parameters
-
string | $gs_filename | The name of the Google Cloud Storage object to serve. |
| mixed[] | $options Array of additional options for serving the object.
-
'content_type': string Content-Type to override when known.
-
'save_as': boolean If True then send the file as an attachment.
-
'start': int Start index of content-range to send.
-
'end': int End index of content-range to send. End index is inclusive.
-
'use_range': boolean Use provided content range from the request's Range header. Mutually exclusive with start and end.
|
- Exceptions
-
| InvalidArgumentException If invalid options are supplied. |
static google\appengine\api\cloud_storage\CloudStorageTools::setSendHeaderFunction |
( |
|
$new_header_func | ) |
|
|
static |
This function is used for unit testing only, it allows replacement of the send_header function that is used to set headers on the response.
- Parameters
-
mixed | $new_header_func | The function to use to set response headers. Set to null to use the inbuilt PHP method header(). |
The documentation for this class was generated from the following file:
- code/googleappengine-read-only/python/php/sdk/google/appengine/api/cloud_storage/CloudStorageTools.php