PHP Class Scalr\Service\Aws\S3\V20060301\S3Api

Implements S3 Low-Level API Actions.
Since: 12.11.2012
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Service\Aws\AbstractApi
Mostra file Open project: scalr/scalr

Protected Properties

Property Type Description
$rangeHeaders
$s3 Scalr\Service\Aws\S3
$versiondate string
$xamzAclAllowedHeaders array List allowed x-amz headers for the ACL requests

Public Methods

Method Description
__construct ( Scalr\Service\Aws\S3 $s3, Scalr\Service\Aws\Client\QueryClient\S3QueryClient $client ) Constructor
addObject ( string $bucketName, string $objectName, string | SplFileInfo $contentFile, array $requestHeaders = null ) : Scalr\Service\Aws\Client\ClientResponseInterface PUT Object action
copyObject ( string $scrBucketName, string $srcObject, string $destBucketName, string $destObject, array $requestHeaders = null, string $versionId = null ) : CopyObjectResponseData Copy Object action
createBucket ( string $bucketName, string $bucketRegion, array $requestHeaders = null ) : BucketData Create Bucket action
deleteBucket ( string $bucketName ) : boolean DELETE Bucket
deleteBucketCors ( string $bucketName ) : boolean DELETE Bucket cors action
deleteBucketLifecycle ( string $bucketName ) : boolean DELETE Bucket lifecycle action
deleteBucketPolicy ( string $bucketName ) : boolean DELETE Bucket policy action
deleteBucketSubresource ( string $bucketName, string $subresource ) : boolean Deletes the specified subresource for the bucket.
deleteBucketTagging ( string $bucketName ) : boolean DELETE Bucket tagging action
deleteBucketWebsite ( string $bucketName ) : boolean DELETE Bucket website action
deleteObject ( string $bucketName, string $objectName, string $versionId = null, string $xAmfMfa = null ) : Scalr\Service\Aws\Client\ClientResponseInterface DELETE Object action.
getBucketAcl ( string $bucketName ) : Scalr\Service\Aws\S3\DataType\AccessControlPolicyData Gets a bucket ACL action.
getBucketCors ( string $bucketName ) : string GET Bucket cors action
getBucketLifecycle ( string $bucketName ) : string GET Bucket lifecycle action
getBucketLocation ( string $bucketName ) : string GET Bucket location action
getBucketLogging ( string $bucketName ) : string GET Bucket logging action
getBucketNotification ( string $bucketName ) : string GET Bucket notification action
getBucketPolicy ( string $bucketName ) : string GET Bucket policy action
getBucketRequestPayment ( string $bucketName ) : string GET Bucket requestPayment action
getBucketSubresource ( string $bucketName, string $subresource ) : Scalr\Service\Aws\Client\ClientResponseInterface Gets a specified bucket subresource
getBucketTagging ( string $bucketName ) : string GET Bucket tagging action
getBucketWebsite ( BucketData | string $bucketName ) : string Returns the web configuration information for the bucket.
getEntityManager ( ) : Scalr\Service\Aws\EntityManager Gets an entity manager
getObject ( string $bucketName, string $objectName, array $requestPars = null, array $requestHeaders = null ) : Scalr\Service\Aws\Client\ClientResponseInterface Gets an object
getObjectAcl ( string $bucketName, string $objectName ) : Scalr\Service\Aws\S3\DataType\AccessControlPolicyData Gets a object ACL action.
getObjectMetadata ( string $bucketName, string $objectName, array $requestHeaders = null ) : Scalr\Service\Aws\Client\ClientResponseInterface HEAD Object action
headBucket ( string $bucketName ) : integer HEAD Bucket action.
listAllMyBuckets ( ) : Scalr\Service\Aws\S3\DataType\BucketList GET Service (ListAllMyBuckets) action
listObjects ( string $bucketName, string $delimiter = null, string $marker = null, string $maxKeys = null, string $prefix = null ) : Scalr\Service\Aws\S3\DataType\ObjectList GET Bucket (List Objects) action
setBucketAcl ( string $bucketName, string | array $aclset ) : boolean PUT Bucket ACL action.
setBucketCors ( string $bucketName, string $cors ) : boolean PUT Bucket cors action
setBucketLifecycle ( string $bucketName, string $lifecycle ) : boolean PUT Bucket lifecycle action
setBucketLogging ( string $bucketName, string $bucketLoggingStatus ) : boolean PUT Bucket logging action
setBucketNotification ( string $bucketName, string $notification ) : boolean PUT Bucket notification action
setBucketPolicy ( string $bucketName, string $policy ) : boolean PUT Bucket policy action
setBucketRequestPayment ( string $bucketName, string $requestPayment ) : boolean PUT Bucket requestPayment action
setBucketSubresource ( string $bucketName, string $subresource, string $putData ) : boolean Puts bucket subresource
setBucketTagging ( string $bucketName, string $tagging ) : boolean PUT Bucket tagging action
setBucketWebsite ( string $bucketName, string $website ) : boolean PUT Bucket website action
setObjectAcl ( string $bucketName, string $objectName, string | array $aclset ) : boolean PUT Object ACL action.

Protected Methods

Method Description
_getBucketLocationXml ( string $bucketRegion ) : string Gets Location XML string
escapeObjectName ( string $objectName ) : string Escapes object name
getFilteredArray ( array $allowedKeys, array $values, boolean $caseInsensitive = true ) : array Filter values with allowed keys.
getFormattedXml ( string $xml ) : string Formats output for the given xml document

Method Details

__construct() public method

Constructor
public __construct ( Scalr\Service\Aws\S3 $s3, Scalr\Service\Aws\Client\QueryClient\S3QueryClient $client )
$s3 Scalr\Service\Aws\S3 S3 instance
$client Scalr\Service\Aws\Client\QueryClient\S3QueryClient Client Interface

_getBucketLocationXml() protected method

Gets Location XML string
protected _getBucketLocationXml ( string $bucketRegion ) : string
$bucketRegion string A bucket region
return string Returns Location XML

addObject() public method

This implementation of the PUT operation adds an object to a bucket.You must have WRITE permissions on a bucket to add an object to it.
public addObject ( string $bucketName, string $objectName, string | SplFileInfo $contentFile, array $requestHeaders = null ) : Scalr\Service\Aws\Client\ClientResponseInterface
$bucketName string A bucket name.
$objectName string An object name.
$contentFile string | SplFileInfo File content of file that should be uploaded. If you provide a path to the file you should pass SplFileInfo object.
$requestHeaders array optional Request headers
return Scalr\Service\Aws\Client\ClientResponseInterface Returns response on success or throws an exception

copyObject() public method

This implementation of the PUT operation creates a copy of an object that is already stored in Amazon S3. A PUT copy operation is the same as performing a GET and then a PUT
public copyObject ( string $scrBucketName, string $srcObject, string $destBucketName, string $destObject, array $requestHeaders = null, string $versionId = null ) : CopyObjectResponseData
$scrBucketName string Source bucket name.
$srcObject string Source object name.
$destBucketName string Destination bucket name.
$destObject string Destination object name.
$requestHeaders array optional Request headers array looks like array(header => value)
$versionId string optional Specifies source version id.
return Scalr\Service\Aws\S3\DataType\CopyObjectResponseData Returns CopyObjectResponseData

createBucket() public method

Creates a new bucket belonging to the account of the authenticated request sender.
public createBucket ( string $bucketName, string $bucketRegion, array $requestHeaders = null ) : BucketData
$bucketName string A bucket name.
$bucketRegion string AWS Region where bucket have to be located.
$requestHeaders array optional Additional request headers. x-amz-acl|x-amz-grant-read|x-amz-grant-write|x-amz-grant-read-acp| x-amz-grant-write-acp|x-amz-grant-full-control
return Scalr\Service\Aws\S3\DataType\BucketData Returns BucketData object on success or throws an exception.

deleteBucket() public method

This implementation of the DELETE operation deletes the bucket named in the URI. All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted.
public deleteBucket ( string $bucketName ) : boolean
$bucketName string A bucket name.
return boolean Returns true on success or throws an exception.

deleteBucketCors() public method

Deletes the cors configuration information set for the bucket.
public deleteBucketCors ( string $bucketName ) : boolean
$bucketName string A bucket name.
return boolean Returns true on success or throws an exception.

deleteBucketLifecycle() public method

Deletes the lifecycle configuration from the specified bucket. Amazon S3 removes all the lifecycle configuration rules in the lifecycle subresource associated with the bucket. Your objects never expire, and Amazon S3 no longer automatically deletes any objects on the basis of rules contained in the deleted lifecycle configuration. To use this operation, you must have permission to perform the s3:PutLifecycleConfiguration action. By default, the bucket owner has this permission and the bucket owner can grant this permission to others. There is usually some time lag before lifecycle configuration deletion is fully propagated to all the Amazon S3 systems.
public deleteBucketLifecycle ( string $bucketName ) : boolean
$bucketName string A bucket name.
return boolean Returns true on success or throws an exception.

deleteBucketPolicy() public method

This implementation of the DELETE operation uses the policy subresource to delete the policy on a specified bucket. To use the operation, you must have DeletePolicy permissions on the specified bucket and be the bucket owner.
public deleteBucketPolicy ( string $bucketName ) : boolean
$bucketName string A bucket name.
return boolean Returns true on success or throws an exception.

deleteBucketSubresource() public method

Deletes the specified subresource for the bucket.
public deleteBucketSubresource ( string $bucketName, string $subresource ) : boolean
$bucketName string A bucket name.
$subresource string A subresource name.
return boolean Returns true on success or throws an exception.

deleteBucketTagging() public method

This implementation of the DELETE operation uses the tagging subresource to remove a tag set from the specified bucket. To use this operation, you must have permission to perform the s3:PutBucketTagging action. By default, the bucket owner has this permission and can grant this permission to others.
public deleteBucketTagging ( string $bucketName ) : boolean
$bucketName string A bucket name.
return boolean Returns true on success or throws an exception.

deleteBucketWebsite() public method

This operation removes the website configuration for a bucket. Amazon S3 returns a 200 OK response upon successfully deleting a website configuration on the specified bucket. You will get a 200 OK response if the website configuration you are trying to delete does not exist on the bucket. Amazon S3 returns a 404 response if the bucket specified in the request does not exist.
public deleteBucketWebsite ( string $bucketName ) : boolean
$bucketName string A bucket name.
return boolean Returns true on success or throws an exception.

deleteObject() public method

The DELETE operation removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects To remove a specific version, you must be the bucket owner and you must use the versionId subresource. Using this subresource permanently deletes the version. If the object deleted is a Delete Marker, Amazon S3 sets the response header, x-amz-delete-marker, to true. If the object you want to delete is in a bucket where the bucket versioning configuration is MFA Delete enabled, you must include the x-amz-mfa request header in the DELETE versionId request. Requests that include x-amz-mfa must use HTTPS.
public deleteObject ( string $bucketName, string $objectName, string $versionId = null, string $xAmfMfa = null ) : Scalr\Service\Aws\Client\ClientResponseInterface
$bucketName string A bucket name.
$objectName string A object name.
$versionId string optional To remove a specific version of the object it must be used.
$xAmfMfa string optional The value is the concatenation of the authentication device's serial number, a space, and the value displayed on your authentication device.
return Scalr\Service\Aws\Client\ClientResponseInterface Returns response on success or throws an exception

escapeObjectName() protected static method

Escapes object name
protected static escapeObjectName ( string $objectName ) : string
$objectName string
return string Returns objectName without leading slash and url encoded

getBucketAcl() public method

This implementation of the GET operation uses the acl subresource to return the access control list (ACL) of a bucket. To use GET to return the ACL of the bucket, you must have READ_ACP access to the bucket. If READ_ACP permission is granted to the anonymous user, you can return the ACL of the bucket without using an authorization header.
public getBucketAcl ( string $bucketName ) : Scalr\Service\Aws\S3\DataType\AccessControlPolicyData
$bucketName string A bucket name
return Scalr\Service\Aws\S3\DataType\AccessControlPolicyData Returns object which describes ACL for the bucket.

getBucketCors() public method

Returns the cors configuration information set for the bucket.
public getBucketCors ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns CORSConfiguration XML Document

getBucketLifecycle() public method

Returns the lifecycle configuration information set on the bucket.
public getBucketLifecycle ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns LifecycleConfiguration XML Document

getBucketLocation() public method

This implementation of the GET operation uses the location subresource to return a bucket's Region. You set the bucket's Region using the LocationContraint request parameter in a PUT Bucket request.
public getBucketLocation ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns bucket location Valid Values: EU | eu-west-1 | eu-central-1 | us-west-1 | us-west-2 | ap-southeast-1 | ap-northeast-1 | ap-northeast-2 | sa-east-1 | empty string (for the US Classic Region)

getBucketLogging() public method

This implementation of the GET operation uses the logging subresource to return the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the bucket owner.
public getBucketLogging ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns XML document

getBucketNotification() public method

This implementation of the GET operation uses the notification subresource to return the notification configuration of a bucket.
public getBucketNotification ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns XML document

getBucketPolicy() public method

This implementation of the GET operation uses the policy subresource to return the policy of a specified bucket. To use this operation, you must have GetPolicy permissions on the specified bucket, and you must be the bucket owner.
public getBucketPolicy ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns bucket policy string (json encoded)

getBucketRequestPayment() public method

This implementation of the GET operation uses the requestPayment subresource to return the request payment configuration of a bucket.
public getBucketRequestPayment ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns XML document

getBucketSubresource() public method

Gets a specified bucket subresource
public getBucketSubresource ( string $bucketName, string $subresource ) : Scalr\Service\Aws\Client\ClientResponseInterface
$bucketName string A bucket name.
$subresource string A bucket subresource name.
return Scalr\Service\Aws\Client\ClientResponseInterface Returns response

getBucketTagging() public method

This implementation of the GET operation uses the tagging subresource to return the tag set associated with the bucket.
public getBucketTagging ( string $bucketName ) : string
$bucketName string A bucket name.
return string Returns XML document

getBucketWebsite() public method

This implementation of the GET operation returns the website configuration associated with a bucket. To host website on Amazon S3, you can configure a bucket as website by adding a website configuration.
public getBucketWebsite ( BucketData | string $bucketName ) : string
$bucketName Scalr\Service\Aws\S3\DataType\BucketData | string A bucket name.
return string Returns CORSConfiguration XML Document

getEntityManager() public method

Gets an entity manager
public getEntityManager ( ) : Scalr\Service\Aws\EntityManager
return Scalr\Service\Aws\EntityManager

getFilteredArray() protected static method

Filter values with allowed keys.
protected static getFilteredArray ( array $allowedKeys, array $values, boolean $caseInsensitive = true ) : array
$allowedKeys array An list of allowed keys.
$values array An associative array of the values looks like array(key => val).
$caseInsensitive boolean optional Case Insencitive comparison
return array Returns filtered array.

getFormattedXml() protected static method

Formats output for the given xml document
protected static getFormattedXml ( string $xml ) : string
$xml string XML Document
return string Returns formatted xml document

getObject() public method

This implementation of the GET operation retrieves objects from Amazon S3. To use GET, you must have READ access to the object. If you grant READ access to the anonymous user, you can return the object without using an authorization header.
public getObject ( string $bucketName, string $objectName, array $requestPars = null, array $requestHeaders = null ) : Scalr\Service\Aws\Client\ClientResponseInterface
$bucketName string An bucket name.
$objectName string An object key name.
$requestPars array optional An additional request query parameters. It accepts only allowed params.
$requestHeaders array opitional An optional request headers. It accepts only allowed headers.
return Scalr\Service\Aws\Client\ClientResponseInterface Returns response

getObjectAcl() public method

This implementation of the GET operation uses the acl subresource to return the access control list (ACL) of an object. To use this operation, you must have READ_ACP access to the object.
public getObjectAcl ( string $bucketName, string $objectName ) : Scalr\Service\Aws\S3\DataType\AccessControlPolicyData
$bucketName string A bucket name.
$objectName string An object name.
return Scalr\Service\Aws\S3\DataType\AccessControlPolicyData Returns object which describes ACL for the object.

getObjectMetadata() public method

The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object. A HEAD request has the same options as a GET operation on an object. The response is identical to the GET response, except that there is no response body.
public getObjectMetadata ( string $bucketName, string $objectName, array $requestHeaders = null ) : Scalr\Service\Aws\Client\ClientResponseInterface
$bucketName string A bucket name.
$objectName string An object name.
$requestHeaders array optional Range headers looks like array(header => value)
return Scalr\Service\Aws\Client\ClientResponseInterface Returns response object on success or throws an exception

headBucket() public method

This operation is useful to determine if a bucket exists and you have permission to access it. The operation returns a 200 OK if the bucket exists and you have permission to access it. Otherwise, the operation might return responses such as 404 Not Found and 403 Forbidden.
public headBucket ( string $bucketName ) : integer
$bucketName string A bucket name.
return integer Returns 200, 404 or 403 depends on bucket state.

listAllMyBuckets() public method

This implementation of the GET operation returns a list of all buckets owned by the authenticated sender of the request.
public listAllMyBuckets ( ) : Scalr\Service\Aws\S3\DataType\BucketList
return Scalr\Service\Aws\S3\DataType\BucketList Returns BucketList

listObjects() public method

This implementation of the GET operation returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. To use this implementation of the operation, you must have READ access to the bucket.
public listObjects ( string $bucketName, string $delimiter = null, string $marker = null, string $maxKeys = null, string $prefix = null ) : Scalr\Service\Aws\S3\DataType\ObjectList
$bucketName string A bucket Name.
$delimiter string optional A delimiter is a character you use to group keys. All keys that contain the same string between the prefix, if specified, and the first occurrence of the delimiter after the prefix are grouped under a single result element, CommonPrefixes. If you don't specify the prefix parameter, then the substring starts at the beginning of the key. The keys that are grouped under CommonPrefixes result element are not returned elsewhere in the response.
$marker string optional Specifies the key to start with when listing objects in a bucket. Amazon S3 lists objects in alphabetical order.
$maxKeys string optional Sets the maximum number of keys returned in the response body. The response might contain fewer keys but will never contain more. If there are additional keys that satisfy the search criteria but were not returned because max-keys was exceeded, the response contains true.To return the additional keys.
$prefix string optional Limits the response to keys that begin with the specified prefix. You can use prefixes to separate a bucket into different groupings of keys. (You can think of using prefix to make groups in the same way you'd use a folder in a file system.)
return Scalr\Service\Aws\S3\DataType\ObjectList Returns list of Objects

setBucketAcl() public method

PUT Bucket ACL action.
public setBucketAcl ( string $bucketName, string | array $aclset ) : boolean
$bucketName string A bucket name.
$aclset string | array XML Document or array of x-amz headers
return boolean Returns True on success of false if failures.

setBucketCors() public method

Sets the cors configuration for your bucket. If the configuration exists, Amazon S3 replaces it.
public setBucketCors ( string $bucketName, string $cors ) : boolean
$bucketName string A bucket name.
$cors string A XML document that defines Cors configuration.
return boolean Returns true on succes or false if failure.

setBucketLifecycle() public method

Sets the lifecycle configuration for your bucket. If the configuration exists, Amazon S3 replaces it.
public setBucketLifecycle ( string $bucketName, string $lifecycle ) : boolean
$bucketName string A bucket name.
$lifecycle string A XML document that defines lifecycle configuration.
return boolean Returns true on succes or false if failure.

setBucketLogging() public method

PUT Bucket logging action
public setBucketLogging ( string $bucketName, string $bucketLoggingStatus ) : boolean
$bucketName string A bucket name.
$bucketLoggingStatus string A XML Document which describes configuration
return boolean Returns true on succes or false if failure.

setBucketNotification() public method

This implementation of the PUT operation uses the notification subresource to enable notifications of specified events for a bucket
public setBucketNotification ( string $bucketName, string $notification ) : boolean
$bucketName string A bucket name.
$notification string A XML Document which describes configuration
return boolean Returns true on succes or false if failure.

setBucketPolicy() public method

This implementation of the GET operation uses the policy subresource to return the policy of a specified bucket. To use this operation, you must have GetPolicy permissions on the specified bucket, and you must be the bucket owner.
public setBucketPolicy ( string $bucketName, string $policy ) : boolean
$bucketName string A bucket name.
$policy string A JSON document that defines policy configuration.
return boolean Returns true on succes or false if failure.

setBucketRequestPayment() public method

This implementation of the PUT operation uses the requestPayment subresource to set the request payment configuration of a bucket.
public setBucketRequestPayment ( string $bucketName, string $requestPayment ) : boolean
$bucketName string A bucket name.
$requestPayment string A XML Document which defines configuration
return boolean Returns true on succes or false if failure.

setBucketSubresource() public method

Puts bucket subresource
public setBucketSubresource ( string $bucketName, string $subresource, string $putData ) : boolean
$bucketName string A bucket name.
$subresource string A subresource name.
$putData string Put data. (xml or json formatted string, depends on subresource configuration)
return boolean Returns true on success or false if failure

setBucketTagging() public method

This implementation of the PUT operation uses the tagging subresource to add a set of tags to an existing bucket.
public setBucketTagging ( string $bucketName, string $tagging ) : boolean
$bucketName string A bucket name.
$tagging string A XML Document which defines configuration
return boolean Returns true on succes or false if failure.

setBucketWebsite() public method

This implementation of the PUT operation uses the website subresource to set the request website configuration of a bucket.
public setBucketWebsite ( string $bucketName, string $website ) : boolean
$bucketName string A bucket name.
$website string A XML Document which defines configuration
return boolean Returns true on succes or false if failure.

setObjectAcl() public method

PUT Object ACL action.
public setObjectAcl ( string $bucketName, string $objectName, string | array $aclset ) : boolean
$bucketName string A bucket name.
$objectName string A bucket name.
$aclset string | array XML Document or array of x-amz headers
return boolean Returns True on success of false if failures.

Property Details

$rangeHeaders protected_oe static_oe property

protected static $rangeHeaders

$s3 protected_oe property

protected S3,Scalr\Service\Aws $s3
return Scalr\Service\Aws\S3

$versiondate protected_oe property

protected string $versiondate
return string

$xamzAclAllowedHeaders protected_oe static_oe property

List allowed x-amz headers for the ACL requests
protected static array $xamzAclAllowedHeaders
return array