PHP Class Scalr\Service\Aws\S3\DataType\BucketData

Since: 12.11.2012
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Service\Aws\S3\AbstractS3DataType
Show file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$bucketName string The bucket name
$creationDate DateTime Creation date

Protected Properties

Property Type Description
$_externalKeys array List of external identifier names.

Public Methods

Method Description
addObject ( string $objectName, string | SplFileInfo $contentFile, array $requestHeaders = null ) : ClientResponseInterface PUT Object action
delete ( ) : boolean DELETE Bucket
deleteCors ( ) : boolean DELETE Bucket cors action
deleteLifecycle ( ) : boolean DELETE Bucket lifecycle action
deleteObject ( string $objectName, string $versionId = null, string $xAmfMfa = null ) : ClientResponseInterface DELETE Object action.
deletePolicy ( ) : boolean DELETE Bucket policy action
deleteTagging ( ) : boolean DELETE Bucket tagging action
deleteWebsite ( ) : boolean DELETE Bucket website action
getAcl ( ) : Scalr\Service\Aws\S3\DataType\AccessControlPolicyData Gets a bucket ACL action.
getCors ( ) : string Returns the cors configuration information set for the bucket.
getLifecycle ( ) : string GET Bucket lifecycle action
getLocation ( ) : string GET Bucket location action
getLogging ( ) : string GET Bucket logging action
getNotification ( BucketData | string $bucketName ) : string GET Bucket notification action
getObject ( string $objectName, array $requestPars = null, array $requestHeaders = null ) : ClientResponseInterface Gets an object
getPolicy ( ) : string GET Bucket policy action
getRequestPayment ( ) : string GET Bucket requestPayment action
getTagging ( ) : string GET Bucket tagging action
listObjects ( string $delimiter = null, string $marker = null, string $maxKeys = null, string $prefix = null ) : Scalr\Service\Aws\S3\DataType\ObjectList GET Bucket (List Objects) action
setAcl ( Scalr\Service\Aws\S3\DataType\AccessControlPolicyData | DOMDocument | string | array $aclset ) : boolean PUT Bucket ACL action.
setCors ( string $cors ) : boolean PUT Bucket cors action
setLifecycle ( string $lifecycle ) : boolean PUT Bucket lifecycle action
setLogging ( string $bucketLoggingStatus ) : boolean PUT Bucket logging action
setNotification ( string $notification ) : boolean PUT Bucket notification action
setPolicy ( string $policy ) : boolean PUT Bucket policy action
setRequestPayment ( string $requestPayment ) : boolean PUT Bucket requestPayment action
setTagging ( string $tagging ) : boolean PUT Bucket tagging action
setWebsite ( string $website ) : boolean PUT Bucket website action

Protected Methods

Method Description
throwExceptionIfNotInitialized ( )

Method Details

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 $objectName, string | SplFileInfo $contentFile, array $requestHeaders = null ) : ClientResponseInterface
$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 ClientResponseInterface Returns response on success or throws an exception

delete() 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 delete ( ) : boolean
return boolean Returns true on success or throws an exception.

deleteCors() public method

Deletes the cors configuration information set for the bucket.
public deleteCors ( ) : boolean
return boolean Returns true on success or throws an exception.

deleteLifecycle() 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 deleteLifecycle ( ) : boolean
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 $objectName, string $versionId = null, string $xAmfMfa = null ) : ClientResponseInterface
$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 ClientResponseInterface Returns response on success or throws an exception

deletePolicy() 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 deletePolicy ( ) : boolean
return boolean Returns true on success or throws an exception.

deleteTagging() 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 deleteTagging ( ) : boolean
return boolean Returns true on success or throws an exception.

deleteWebsite() 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 deleteWebsite ( ) : boolean
return boolean Returns true on success or throws an exception.

getAcl() 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 getAcl ( ) : Scalr\Service\Aws\S3\DataType\AccessControlPolicyData
return Scalr\Service\Aws\S3\DataType\AccessControlPolicyData Returns object which describes ACL for the bucket.

getCors() public method

Returns the cors configuration information set for the bucket.
public getCors ( ) : string
return string Returns CORSConfiguration XML Document

getLifecycle() public method

Returns the lifecycle configuration information set on the bucket.
public getLifecycle ( ) : string
return string Returns LifecycleConfiguration XML Document

getLocation() 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 getLocation ( ) : string
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)

getLogging() 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 getLogging ( ) : string
return string Returns XML document

getNotification() public method

This implementation of the GET operation uses the notification subresource to return the notification configuration of a bucket.
public getNotification ( BucketData | string $bucketName ) : string
$bucketName BucketData | string A bucket name.
return string Returns 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 $objectName, array $requestPars = null, array $requestHeaders = null ) : ClientResponseInterface
$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 ClientResponseInterface Returns response

getPolicy() 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 getPolicy ( ) : string
return string Returns bucket policy string (json encoded)

getRequestPayment() public method

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

getTagging() public method

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

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 $delimiter = null, string $marker = null, string $maxKeys = null, string $prefix = null ) : Scalr\Service\Aws\S3\DataType\ObjectList
$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

setAcl() public method

Sets bucket's ACL.
public setAcl ( Scalr\Service\Aws\S3\DataType\AccessControlPolicyData | DOMDocument | string | array $aclset ) : boolean
$aclset Scalr\Service\Aws\S3\DataType\AccessControlPolicyData | DOMDocument | string | array AccessControlPolicyData object or XML Document or array of x-amz headers
return boolean Returns True on success of false if failures.

setCors() public method

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

setLifecycle() public method

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

setLogging() public method

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

setNotification() public method

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

setPolicy() 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 setPolicy ( string $policy ) : boolean
$policy string A JSON document that defines policy configuration.
return boolean Returns true on succes or false if failure.

setRequestPayment() public method

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

setTagging() public method

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

setWebsite() public method

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

throwExceptionIfNotInitialized() protected method

Property Details

$_externalKeys protected property

List of external identifier names.
protected array $_externalKeys
return array

$bucketName public property

The bucket name
public string $bucketName
return string

$creationDate public property

Creation date
public DateTime $creationDate
return DateTime