Обновление клиента (apps, 3rdparty, install)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
Tracking Breaking changes in 1.0.0
|
||||
|
||||
* Removed `dataSerializer` parameter from `BlobRextProxy` constructor.
|
||||
* Option parameter type of `BlobRestProxy::CreateBlockBlob` and `BlobRestProxy::CreatePageBlobFromContent` changed and added `setUseTransactionalMD5` method.
|
||||
* Deprecated PHP 5.5 support.
|
||||
@@ -0,0 +1 @@
|
||||
This [repository](https://github.com/azure/azure-storage-blob-php) is currently used for releasing only, please go to [azure-storage-php](https://github.com/azure/azure-storage-php) for submitting issues or contribution.
|
||||
@@ -0,0 +1,58 @@
|
||||
2022.08 - version 1.5.4
|
||||
* Check `$copyProgress` is not null before using it in `strpos`.
|
||||
|
||||
2021.09 - version 1.5.3
|
||||
* Upgraded dependency for `azure-storage-common` to version 1.5.2.
|
||||
* Resolved some interface inconsistency between `IBlob`/`BlobRestProxy`.
|
||||
* Imported `Psr\Http\Message\StreamInterface` in `IBlob`.
|
||||
|
||||
2020.12 - version 1.5.2
|
||||
* Resolved an issue where access condition does not work for large block blob uploads.
|
||||
* Guzzle version is now updated to support both 6.x and 7.x.
|
||||
|
||||
2020.08 - version 1.5.1
|
||||
* Lower case query parameter names.
|
||||
|
||||
2020.01 - version 1.5.0
|
||||
|
||||
* Added support to include deleted in blob list.
|
||||
* Added support to undelete a blob.
|
||||
* Fixed the issue in SAS token where special characters were not correctly encoded.
|
||||
* Samples no longer uses ‘BlobRestProxy’ directly, instead, ‘ServicesBuilder’ is used.
|
||||
|
||||
2019.04 - version 1.4.0
|
||||
|
||||
* Added support for OAuth authentication.
|
||||
* Resolved some issues on Linux platform.
|
||||
|
||||
2019.03 - version 1.3.0
|
||||
|
||||
* Fixed a bug where blob name '0' cannot be created.
|
||||
* Documentation refinement.
|
||||
* `ListContainer` now can have ETag more robustly fetched from response header.
|
||||
|
||||
2018.08 - version 1.2.0
|
||||
|
||||
* Updated Azure Storage API version from 2016-05-31 to 2017-04-17.
|
||||
* Added method `setBlobTier` method in `BlobRestProxy` to set blob tiers.
|
||||
* Added support setting or getting blob tiers related properties when creating blobs, listing blobs, getting blob properties and copying blobs.
|
||||
* Set the `getBlobUrl()` method in `BlobRestProxy` visibility to public.
|
||||
|
||||
2018.04 - version 1.1.0
|
||||
|
||||
* Private method BlobRestProxy::getBlobUrl now preserves primary URI path when exists.
|
||||
* MD files are modified for better readability and formatting.
|
||||
* CACERT can now be set when creating RestProxies using `$options` parameter.
|
||||
* Added a sample in `BlobSamples.php` to list all blobs with certain prefix. This is a recommended implementation of using continuation token to list all the blobs.
|
||||
* Removed unnecessary trailing spaces.
|
||||
* Assertions are re-factored in test cases.
|
||||
* Now the test framework uses `PHPUnit\Framework\TestCase` instead of `PHPUnit_Framework_TestCase`.
|
||||
|
||||
2018.01 - version 1.0.0
|
||||
|
||||
* Created `BlobSharedAccessSignatureHelper` and moved method `SharedAccessSignatureHelper::generateBlobServiceSharedAccessSignatureToken()` into `BlobSharedAccessSignatureHelper`.
|
||||
* Added static builder methods `createBlobService` and `createContainerAnonymousAccess` into `BlobRestProxy`.
|
||||
* Removed `dataSerializer` parameter from `BlobRestProxy` constructor.
|
||||
* Added `setUseTransactionalMD5` method for options of `BlobRestProxy::CreateBlockBlob` and `BlobRestProxy::CreatePageBlobFromContent`. Default false, enabling transactional MD5 validation will take more cpu and memory resources.
|
||||
* Fixed a bug that CopyBlobFromURLOptions not found.
|
||||
* Deprecated PHP 5.5 support.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Microsoft Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
File diff suppressed because it is too large
Load Diff
+213
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\SharedAccessSignatureHelper;
|
||||
|
||||
/**
|
||||
* Provides methods to generate Azure Storage Shared Access Signature
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobSharedAccessSignatureHelper extends SharedAccessSignatureHelper
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $accountName the name of the storage account.
|
||||
* @param string $accountKey the shared key of the storage account
|
||||
*
|
||||
*/
|
||||
public function __construct($accountName, $accountKey)
|
||||
{
|
||||
parent::__construct($accountName, $accountKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates Blob service shared access signature.
|
||||
*
|
||||
* This only supports version 2015-04-05 and later.
|
||||
*
|
||||
* @param string $signedResource Resource name to generate the
|
||||
* canonicalized resource.
|
||||
* It can be Resources::RESOURCE_TYPE_BLOB
|
||||
* or Resources::RESOURCE_TYPE_CONTAINER.
|
||||
* @param string $resourceName The name of the resource, including
|
||||
* the path of the resource. It should be
|
||||
* - {container}/{blob}: for blobs,
|
||||
* - {container}: for containers, e.g.:
|
||||
* mymusic/music.mp3 or
|
||||
* music.mp3
|
||||
* @param string $signedPermissions Signed permissions.
|
||||
* @param \Datetime|string $signedExpiry Signed expiry date.
|
||||
* @param \Datetime|string $signedStart Signed start date.
|
||||
* @param string $signedIP Signed IP address.
|
||||
* @param string $signedProtocol Signed protocol.
|
||||
* @param string $signedIdentifier Signed identifier.
|
||||
* @param string $cacheControl Cache-Control header (rscc).
|
||||
* @param string $contentDisposition Content-Disposition header (rscd).
|
||||
* @param string $contentEncoding Content-Encoding header (rsce).
|
||||
* @param string $contentLanguage Content-Language header (rscl).
|
||||
* @param string $contentType Content-Type header (rsct).
|
||||
*
|
||||
* @see Constructing an service SAS at
|
||||
* https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
|
||||
* @return string
|
||||
*/
|
||||
public function generateBlobServiceSharedAccessSignatureToken(
|
||||
$signedResource,
|
||||
$resourceName,
|
||||
$signedPermissions,
|
||||
$signedExpiry,
|
||||
$signedStart = "",
|
||||
$signedIP = "",
|
||||
$signedProtocol = "",
|
||||
$signedIdentifier = "",
|
||||
$cacheControl = "",
|
||||
$contentDisposition = "",
|
||||
$contentEncoding = "",
|
||||
$contentLanguage = "",
|
||||
$contentType = ""
|
||||
)
|
||||
{
|
||||
// check that the resource name is valid.
|
||||
Validate::canCastAsString($signedResource, 'signedResource');
|
||||
Validate::notNullOrEmpty($signedResource, 'signedResource');
|
||||
Validate::isTrue(
|
||||
$signedResource == Resources::RESOURCE_TYPE_BLOB ||
|
||||
$signedResource == Resources::RESOURCE_TYPE_CONTAINER,
|
||||
\sprintf(
|
||||
Resources::INVALID_VALUE_MSG,
|
||||
'$signedResource',
|
||||
'Can only be \'b\' or \'c\'.'
|
||||
)
|
||||
);
|
||||
|
||||
// check that the resource name is valid.
|
||||
Validate::notNullOrEmpty($resourceName, 'resourceName');
|
||||
Validate::canCastAsString($resourceName, 'resourceName');
|
||||
|
||||
// validate and sanitize signed permissions
|
||||
$signedPermissions = $this->validateAndSanitizeStringWithArray(
|
||||
strtolower($signedPermissions),
|
||||
Resources::ACCESS_PERMISSIONS[$signedResource]
|
||||
);
|
||||
|
||||
// check that expiry is valid
|
||||
if ($signedExpiry instanceof \Datetime) {
|
||||
$signedExpiry = Utilities::isoDate($signedExpiry);
|
||||
}
|
||||
Validate::notNullOrEmpty($signedExpiry, 'signedExpiry');
|
||||
Validate::canCastAsString($signedExpiry, 'signedExpiry');
|
||||
Validate::isDateString($signedExpiry, 'signedExpiry');
|
||||
|
||||
// check that signed start is valid
|
||||
if ($signedStart instanceof \Datetime) {
|
||||
$signedStart = Utilities::isoDate($signedStart);
|
||||
}
|
||||
Validate::canCastAsString($signedStart, 'signedStart');
|
||||
if (strlen($signedStart) > 0) {
|
||||
Validate::isDateString($signedStart, 'signedStart');
|
||||
}
|
||||
|
||||
// check that signed IP is valid
|
||||
Validate::canCastAsString($signedIP, 'signedIP');
|
||||
|
||||
// validate and sanitize signed protocol
|
||||
$signedProtocol = $this->validateAndSanitizeSignedProtocol($signedProtocol);
|
||||
|
||||
// check that signed identifier is valid
|
||||
Validate::canCastAsString($signedIdentifier, 'signedIdentifier');
|
||||
Validate::isTrue(
|
||||
strlen($signedIdentifier) <= 64,
|
||||
sprintf(Resources::INVALID_STRING_LENGTH, 'signedIdentifier', 'maximum 64')
|
||||
);
|
||||
|
||||
Validate::canCastAsString($cacheControl, 'cacheControl');
|
||||
Validate::canCastAsString($contentDisposition, 'contentDisposition');
|
||||
Validate::canCastAsString($contentEncoding, 'contentEncoding');
|
||||
Validate::canCastAsString($contentLanguage, 'contentLanguage');
|
||||
Validate::canCastAsString($contentType, 'contentType');
|
||||
|
||||
// construct an array with the parameters to generate the shared access signature at the account level
|
||||
$parameters = array();
|
||||
$parameters[] = $signedPermissions;
|
||||
$parameters[] = $signedStart;
|
||||
$parameters[] = $signedExpiry;
|
||||
$parameters[] = static::generateCanonicalResource(
|
||||
$this->accountName,
|
||||
Resources::RESOURCE_TYPE_BLOB,
|
||||
$resourceName
|
||||
);
|
||||
$parameters[] = $signedIdentifier;
|
||||
$parameters[] = $signedIP;
|
||||
$parameters[] = $signedProtocol;
|
||||
$parameters[] = Resources::STORAGE_API_LATEST_VERSION;
|
||||
$parameters[] = $cacheControl;
|
||||
$parameters[] = $contentDisposition;
|
||||
$parameters[] = $contentEncoding;
|
||||
$parameters[] = $contentLanguage;
|
||||
$parameters[] = $contentType;
|
||||
|
||||
// implode the parameters into a string
|
||||
$stringToSign = implode("\n", $parameters);
|
||||
// decode the account key from base64
|
||||
$decodedAccountKey = base64_decode($this->accountKey);
|
||||
// create the signature with hmac sha256
|
||||
$signature = hash_hmac("sha256", $stringToSign, $decodedAccountKey, true);
|
||||
// encode the signature as base64
|
||||
$sig = urlencode(base64_encode($signature));
|
||||
|
||||
$buildOptQueryStr = function ($string, $abrv) {
|
||||
return $string === '' ? '' : $abrv . $string;
|
||||
};
|
||||
//adding all the components for account SAS together.
|
||||
$sas = 'sv=' . Resources::STORAGE_API_LATEST_VERSION;
|
||||
$sas .= '&sr=' . $signedResource;
|
||||
$sas .= $buildOptQueryStr($cacheControl, '&rscc=');
|
||||
$sas .= $buildOptQueryStr($contentDisposition, '&rscd=');
|
||||
$sas .= $buildOptQueryStr($contentEncoding, '&rsce=');
|
||||
$sas .= $buildOptQueryStr($contentLanguage, '&rscl=');
|
||||
$sas .= $buildOptQueryStr($contentType, '&rsct=');
|
||||
|
||||
$sas .= $buildOptQueryStr($signedStart, '&st=');
|
||||
$sas .= '&se=' . $signedExpiry;
|
||||
$sas .= '&sp=' . $signedPermissions;
|
||||
$sas .= $buildOptQueryStr($signedIP, '&sip=');
|
||||
$sas .= $buildOptQueryStr($signedProtocol, '&spr=');
|
||||
$sas .= $buildOptQueryStr($signedIdentifier, '&si=');
|
||||
$sas .= '&sig=' . $sig;
|
||||
|
||||
return $sas;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Common\Internal
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Internal;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Resources;
|
||||
|
||||
/**
|
||||
* Project resources.
|
||||
*
|
||||
* @ignore
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Common\Internal
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobResources extends Resources
|
||||
{
|
||||
// @codingStandardsIgnoreStart
|
||||
|
||||
const BLOB_SDK_VERSION = '1.5.4';
|
||||
const STORAGE_API_LATEST_VERSION = '2017-11-09';
|
||||
|
||||
// Error messages
|
||||
const INVALID_BTE_MSG = "The blob block type must exist in %s";
|
||||
const INVALID_BLOB_PAT_MSG = 'The provided access type is invalid.';
|
||||
const INVALID_ACH_MSG = 'The provided access condition header is invalid';
|
||||
const ERROR_TOO_LARGE_FOR_BLOCK_BLOB = 'Error: Exceeds the upper limit of the blob.';
|
||||
const ERROR_RANGE_NOT_ALIGN_TO_512 = 'Error: Range of the page blob must be align to 512';
|
||||
const ERROR_CONTAINER_NOT_EXIST = 'The specified container does not exist';
|
||||
const ERROR_BLOB_NOT_EXIST = 'The specified blob does not exist';
|
||||
const CONTENT_SIZE_TOO_LARGE = 'The content is too large for the selected blob type.';
|
||||
|
||||
// Headers
|
||||
const X_MS_BLOB_PUBLIC_ACCESS = 'x-ms-blob-public-access';
|
||||
const X_MS_BLOB_SEQUENCE_NUMBER = 'x-ms-blob-sequence-number';
|
||||
const X_MS_BLOB_SEQUENCE_NUMBER_ACTION = 'x-ms-sequence-number-action';
|
||||
const X_MS_BLOB_TYPE = 'x-ms-blob-type';
|
||||
const X_MS_BLOB_CONTENT_TYPE = 'x-ms-blob-content-type';
|
||||
const X_MS_BLOB_CONTENT_ENCODING = 'x-ms-blob-content-encoding';
|
||||
const X_MS_BLOB_CONTENT_LANGUAGE = 'x-ms-blob-content-language';
|
||||
const X_MS_BLOB_CONTENT_MD5 = 'x-ms-blob-content-md5';
|
||||
const X_MS_BLOB_CACHE_CONTROL = 'x-ms-blob-cache-control';
|
||||
const X_MS_BLOB_CONTENT_DISPOSITION = 'x-ms-blob-content-disposition';
|
||||
const X_MS_BLOB_CONTENT_LENGTH = 'x-ms-blob-content-length';
|
||||
const X_MS_BLOB_CONDITION_MAXSIZE = 'x-ms-blob-condition-maxsize';
|
||||
const X_MS_BLOB_CONDITION_APPENDPOS = 'x-ms-blob-condition-appendpos';
|
||||
const X_MS_BLOB_APPEND_OFFSET = 'x-ms-blob-append-offset';
|
||||
const X_MS_BLOB_COMMITTED_BLOCK_COUNT = 'x-ms-blob-committed-block-count';
|
||||
const X_MS_LEASE_DURATION = 'x-ms-lease-duration';
|
||||
const X_MS_LEASE_ID = 'x-ms-lease-id';
|
||||
const X_MS_LEASE_TIME = 'x-ms-lease-time';
|
||||
const X_MS_LEASE_STATUS = 'x-ms-lease-status';
|
||||
const X_MS_LEASE_STATE = 'x-ms-lease-state';
|
||||
const X_MS_LEASE_ACTION = 'x-ms-lease-action';
|
||||
const X_MS_PROPOSED_LEASE_ID = 'x-ms-proposed-lease-id';
|
||||
const X_MS_LEASE_BREAK_PERIOD = 'x-ms-lease-break-period';
|
||||
const X_MS_PAGE_WRITE = 'x-ms-page-write';
|
||||
const X_MS_REQUEST_SERVER_ENCRYPTED = 'x-ms-request-server-encrypted';
|
||||
const X_MS_SERVER_ENCRYPTED = 'x-ms-server-encrypted';
|
||||
const X_MS_INCREMENTAL_COPY = 'x-ms-incremental-copy';
|
||||
const X_MS_COPY_DESTINATION_SNAPSHOT = 'x-ms-copy-destination-snapshot';
|
||||
const X_MS_ACCESS_TIER = 'x-ms-access-tier';
|
||||
const X_MS_ACCESS_TIER_INFERRED = 'x-ms-access-tier-inferred';
|
||||
const X_MS_ACCESS_TIER_CHANGE_TIME = 'x-ms-access-tier-change-time';
|
||||
const X_MS_ARCHIVE_STATUS = 'x-ms-archive-status';
|
||||
const MAX_BLOB_SIZE = 'x-ms-blob-condition-maxsize';
|
||||
const MAX_APPEND_POSITION = 'x-ms-blob-condition-appendpos';
|
||||
const SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL = 'x-ms-if-sequence-number-le';
|
||||
const SEQUENCE_NUMBER_LESS_THAN = 'x-ms-if-sequence-number-lt';
|
||||
const SEQUENCE_NUMBER_EQUAL = 'x-ms-if-sequence-number-eq';
|
||||
const BLOB_CONTENT_MD5 = 'x-ms-blob-content-md5';
|
||||
|
||||
// Query parameters
|
||||
const QP_DELIMITER = 'Delimiter';
|
||||
const QP_BLOCKID = 'blockid';
|
||||
const QP_BLOCK_LIST_TYPE = 'blocklisttype';
|
||||
const QP_PRE_SNAPSHOT = 'prevsnapshot';
|
||||
|
||||
// Resource permissions
|
||||
const ACCESS_PERMISSIONS = [
|
||||
Resources::RESOURCE_TYPE_BLOB => ['r', 'a', 'c', 'w', 'd'],
|
||||
Resources::RESOURCE_TYPE_CONTAINER => ['r', 'a', 'c', 'w', 'd', 'l']
|
||||
];
|
||||
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\WindowsAzureUtilities;
|
||||
|
||||
/**
|
||||
* Represents a set of access conditions to be used for operations against the
|
||||
* storage services.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class AccessCondition
|
||||
{
|
||||
private $_header = Resources::EMPTY_STRING;
|
||||
private $_value;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $headerType header name
|
||||
* @param string $value header value
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
protected function __construct($headerType, $value)
|
||||
{
|
||||
$this->setHeader($headerType);
|
||||
$this->setValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies that no access condition is set.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function none()
|
||||
{
|
||||
return new AccessCondition(Resources::EMPTY_STRING, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the resource's ETag value matches the specified ETag value.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>If-Match</i> conditional header. If this access condition is set, the
|
||||
* operation is performed only if the ETag of the resource matches the specified
|
||||
* ETag.
|
||||
* <p>
|
||||
* For more information, see
|
||||
* <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param string $etag a string that represents the ETag value to check.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function ifMatch($etag)
|
||||
{
|
||||
return new AccessCondition(Resources::IF_MATCH, $etag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the resource has been modified since the specified time.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>If-Modified-Since</i> conditional header. If this access condition is set,
|
||||
* the operation is performed only if the resource has been modified since the
|
||||
* specified time.
|
||||
* <p>
|
||||
* For more information, see
|
||||
* <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param \DateTime $lastModified date that represents the last-modified
|
||||
* time to check for the resource.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function ifModifiedSince(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
return new AccessCondition(
|
||||
Resources::IF_MODIFIED_SINCE,
|
||||
$lastModified
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the resource's ETag value does not match the specified ETag value.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>If-None-Match</i> conditional header. If this access condition is set, the
|
||||
* operation is performed only if the ETag of the resource does not match the
|
||||
* specified ETag.
|
||||
* <p>
|
||||
* For more information,
|
||||
* see <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param string $etag string that represents the ETag value to check.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function ifNoneMatch($etag)
|
||||
{
|
||||
return new AccessCondition(Resources::IF_NONE_MATCH, $etag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the resource has not been modified since the specified time.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>If-Unmodified-Since</i> conditional header. If this access condition is
|
||||
* set, the operation is performed only if the resource has not been modified
|
||||
* since the specified time.
|
||||
* <p>
|
||||
* For more information, see
|
||||
* <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param \DateTime $lastModified date that represents the last-modified
|
||||
* time to check for the resource.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function ifNotModifiedSince(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
return new AccessCondition(
|
||||
Resources::IF_UNMODIFIED_SINCE,
|
||||
$lastModified
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the operation would cause the blob to exceed that limit or if the append
|
||||
* position is equal to this number.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>x-ms-blob-condition-appendpos</i> conditional header. If this access condition
|
||||
* is set, the operation is performed only if the append position is equal to this number
|
||||
* <p>
|
||||
* For more information,
|
||||
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param int $appendPosition int that represents the append position
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function appendPosition($appendPosition)
|
||||
{
|
||||
return new AccessCondition(Resources::MAX_APPEND_POSITION, $appendPosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the operation would cause the blob to exceed that limit or if the blob size
|
||||
* is already greater than the value specified in this header.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>x-ms-blob-condition-maxsize</i> conditional header. If this access condition
|
||||
* is set, the operation is performed only if the operation would cause the blob
|
||||
* to exceed that limit or if the blob size is already greater than the value
|
||||
* specified in this header.
|
||||
* <p>
|
||||
* For more information,
|
||||
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/append-block'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param int $maxBlobSize int that represents the max blob size
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function maxBlobSize($maxBlobSize)
|
||||
{
|
||||
return new AccessCondition(Resources::MAX_BLOB_SIZE, $maxBlobSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the blob’s sequence number is less than the specified value.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>x-ms-if-sequence-number-lt</i> conditional header. If this access condition
|
||||
* is set, the operation is performed only if the blob’s sequence number is less
|
||||
* than the specified value.
|
||||
* <p>
|
||||
* For more information,
|
||||
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param int $sequenceNumber int that represents the sequence number value to check.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function ifSequenceNumberLessThan($sequenceNumber)
|
||||
{
|
||||
return new AccessCondition(Resources::SEQUENCE_NUMBER_LESS_THAN, $sequenceNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the blob’s sequence number is equal to the specified value.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>x-ms-if-sequence-number-eq</i> conditional header. If this access condition
|
||||
* is set, the operation is performed only if the blob’s sequence number is equal to
|
||||
* the specified value.
|
||||
* <p>
|
||||
* For more information,
|
||||
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param int $sequenceNumber int that represents the sequence number value to check.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function ifSequenceNumberEqual($sequenceNumber)
|
||||
{
|
||||
return new AccessCondition(Resources::SEQUENCE_NUMBER_EQUAL, $sequenceNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an access condition such that an operation will be performed only if
|
||||
* the blob’s sequence number is less than or equal to the specified value.
|
||||
* <p>
|
||||
* Setting this access condition modifies the request to include the HTTP
|
||||
* <i>x-ms-if-sequence-number-le</i> conditional header. If this access condition
|
||||
* is set, the operation is performed only if the blob’s sequence number is less
|
||||
* than or equal to the specified value.
|
||||
* <p>
|
||||
* For more information,
|
||||
* see <a href= 'https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-page'>
|
||||
* Specifying Conditional Headers for Blob Service Operations</a>.
|
||||
*
|
||||
* @param int $sequenceNumber int that represents the sequence number value to check.
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition
|
||||
*/
|
||||
public static function ifSequenceNumberLessThanOrEqual($sequenceNumber)
|
||||
{
|
||||
return new AccessCondition(Resources::SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL, $sequenceNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets header type
|
||||
*
|
||||
* @param string $headerType can be one of Resources
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setHeader($headerType)
|
||||
{
|
||||
$valid = AccessCondition::isValid($headerType);
|
||||
Validate::isTrue($valid, Resources::INVALID_HT_MSG);
|
||||
|
||||
$this->_header = $headerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets header type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHeader()
|
||||
{
|
||||
return $this->_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the header value
|
||||
*
|
||||
* @param string $value the value to use
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the header value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the $headerType belongs to valid header types
|
||||
*
|
||||
* @param string $headerType candidate header type
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isValid($headerType)
|
||||
{
|
||||
if ($headerType == Resources::EMPTY_STRING
|
||||
|| $headerType == Resources::IF_UNMODIFIED_SINCE
|
||||
|| $headerType == Resources::IF_MATCH
|
||||
|| $headerType == Resources::IF_MODIFIED_SINCE
|
||||
|| $headerType == Resources::IF_NONE_MATCH
|
||||
|| $headerType == Resources::MAX_BLOB_SIZE
|
||||
|| $headerType == Resources::MAX_APPEND_POSITION
|
||||
|| $headerType == Resources::SEQUENCE_NUMBER_LESS_THAN_OR_EQUAL
|
||||
|| $headerType == Resources::SEQUENCE_NUMBER_LESS_THAN
|
||||
|| $headerType == Resources::SEQUENCE_NUMBER_EQUAL
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Common\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Trait implementing setting and getting accessTier.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
trait AccessTierTrait
|
||||
{
|
||||
/**
|
||||
* @var string $accessTier Version 2017-04-17 and newer. For page blobs on a premium storage account, otherwise a block blob
|
||||
* on blob storage account or storageV2 general account.
|
||||
* Specifies the tier to be set on the blob. Currently, for block blob, tiers like "Hot", "Cool"
|
||||
* and "Archive" can be used; for premium page blobs, "P4", "P6", "P10" and etc. can be set.
|
||||
* Check following link for a full list of supported tiers.
|
||||
* https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tier
|
||||
*/
|
||||
private $accessTier;
|
||||
|
||||
/**
|
||||
* Gets blob access tier.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessTier()
|
||||
{
|
||||
return $this->accessTier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob access tier.
|
||||
*
|
||||
* @param string $accessTier value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessTier($accessTier)
|
||||
{
|
||||
$this->accessTier = $accessTier;
|
||||
}
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for appendBlock wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class AppendBlockOptions extends BlobServiceOptions
|
||||
{
|
||||
private $contentMD5;
|
||||
private $maxBlobSize;
|
||||
private $appendPosition;
|
||||
|
||||
/**
|
||||
* Gets block contentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets block contentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max length in bytes allowed for the append blob to grow to.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxBlobSize()
|
||||
{
|
||||
return $this->maxBlobSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the max length in bytes allowed for the append blob to grow to.
|
||||
*
|
||||
* @param int $maxBlobSize value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMaxBlobSize($maxBlobSize)
|
||||
{
|
||||
$this->maxBlobSize = $maxBlobSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets append blob appendPosition.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAppendPosition()
|
||||
{
|
||||
return $this->appendPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets append blob appendPosition.
|
||||
*
|
||||
* @param int $appendPosition value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAppendPosition($appendPosition)
|
||||
{
|
||||
$this->appendPosition = $appendPosition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* The result of calling appendBlock API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class AppendBlockResult
|
||||
{
|
||||
private $appendOffset;
|
||||
private $committedBlockCount;
|
||||
private $contentMD5;
|
||||
private $etag;
|
||||
private $lastModified;
|
||||
private $requestServerEncrypted;
|
||||
|
||||
/**
|
||||
* Creates AppendBlockResult object from the response of the put block request.
|
||||
*
|
||||
* @param array $headers The HTTP response headers in array representation.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return AppendBlockResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new AppendBlockResult();
|
||||
|
||||
$result->setAppendOffset(
|
||||
intval(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_BLOB_APPEND_OFFSET, $headers
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$result->setCommittedBlockCount(
|
||||
intval(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_BLOB_COMMITTED_BLOCK_COUNT, $headers
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$result->setContentMD5(
|
||||
Utilities::tryGetValueInsensitive(Resources::CONTENT_MD5, $headers)
|
||||
);
|
||||
|
||||
$result->setEtag(
|
||||
Utilities::tryGetValueInsensitive(Resources::ETAG, $headers)
|
||||
);
|
||||
|
||||
if (Utilities::arrayKeyExistsInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
)) {
|
||||
$lastModified = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$lastModified = Utilities::rfc1123ToDateTime($lastModified);
|
||||
|
||||
$result->setLastModified($lastModified);
|
||||
}
|
||||
|
||||
$result->setRequestServerEncrypted(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_REQUEST_SERVER_ENCRYPTED,
|
||||
$headers
|
||||
),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Etag of the blob that the client can use to perform conditional
|
||||
* PUT operations by using the If-Match request header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEtag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the etag value.
|
||||
*
|
||||
* @param string $etag etag as a string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setEtag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets $lastModified value.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $lastModified value.
|
||||
*
|
||||
* @param \DateTime $lastModified $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified($lastModified)
|
||||
{
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets block content MD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the content MD5 value.
|
||||
*
|
||||
* @param string $contentMD5 conent MD5 as a string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the offset at which the block was committed, in bytes.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAppendOffset()
|
||||
{
|
||||
return $this->appendOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the offset at which the block was committed, in bytes.
|
||||
*
|
||||
* @param int $appendOffset append offset, in bytes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setAppendOffset($appendOffset)
|
||||
{
|
||||
$this->appendOffset = $appendOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of committed blocks present in the blob.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCommittedBlockCount()
|
||||
{
|
||||
return $this->committedBlockCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of committed blocks present in the blob.
|
||||
*
|
||||
* @param int $committedBlockCount the number of committed blocks present in the blob.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setCommittedBlockCount($committedBlockCount)
|
||||
{
|
||||
$this->committedBlockCount = $committedBlockCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the whether the contents of the request are successfully encrypted.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRequestServerEncrypted()
|
||||
{
|
||||
return $this->requestServerEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request server encryption value.
|
||||
*
|
||||
* @param boolean $requestServerEncrypted
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRequestServerEncrypted($requestServerEncrypted)
|
||||
{
|
||||
$this->requestServerEncrypted = $requestServerEncrypted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Represents windows azure blob object
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class Blob
|
||||
{
|
||||
private $_name;
|
||||
private $_url;
|
||||
private $_snapshot;
|
||||
private $_metadata;
|
||||
private $_properties;
|
||||
/**
|
||||
* Gets blob name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob name.
|
||||
*
|
||||
* @param string $name value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->_snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
{
|
||||
$this->_snapshot = $snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob url.
|
||||
*
|
||||
* @param string $url value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->_url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->_metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob metadata.
|
||||
*
|
||||
* @param array $metadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata = null)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob properties.
|
||||
*
|
||||
* @return BlobProperties
|
||||
*/
|
||||
public function getProperties()
|
||||
{
|
||||
return $this->_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob properties.
|
||||
*
|
||||
* @param BlobProperties $properties value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setProperties($properties)
|
||||
{
|
||||
$this->_properties = $properties;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources;
|
||||
use MicrosoftAzure\Storage\Common\Models\AccessPolicy;
|
||||
|
||||
/**
|
||||
* Holds access policy elements
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobAccessPolicy extends AccessPolicy
|
||||
{
|
||||
/**
|
||||
* Get the valid permissions for the given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getResourceValidPermissions()
|
||||
{
|
||||
return BlobResources::ACCESS_PERMISSIONS[
|
||||
BlobResources::RESOURCE_TYPE_BLOB
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(BlobResources::RESOURCE_TYPE_BLOB);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Holds available blob block types
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobBlockType
|
||||
{
|
||||
const COMMITTED_TYPE = 'Committed';
|
||||
const UNCOMMITTED_TYPE = 'Uncommitted';
|
||||
const LATEST_TYPE = 'Latest';
|
||||
|
||||
/**
|
||||
* Validates the provided type.
|
||||
*
|
||||
* @param string $type The entry type.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isValid($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case self::COMMITTED_TYPE:
|
||||
case self::LATEST_TYPE:
|
||||
case self::UNCOMMITTED_TYPE:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Represents BlobPrefix object
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobPrefix
|
||||
{
|
||||
private $_name;
|
||||
|
||||
/**
|
||||
* Gets blob name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob name.
|
||||
*
|
||||
* @param string $name value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,887 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Represents blob properties
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobProperties
|
||||
{
|
||||
private $lastModified;
|
||||
private $creationTime;
|
||||
private $etag;
|
||||
private $contentType;
|
||||
private $contentLength;
|
||||
private $contentEncoding;
|
||||
private $contentLanguage;
|
||||
private $contentMD5;
|
||||
private $contentRange;
|
||||
private $cacheControl;
|
||||
private $contentDisposition;
|
||||
private $blobType;
|
||||
private $leaseStatus;
|
||||
private $leaseState;
|
||||
private $leaseDuration;
|
||||
private $sequenceNumber;
|
||||
private $serverEncrypted;
|
||||
private $committedBlockCount;
|
||||
private $copyState;
|
||||
private $copyDestinationSnapshot;
|
||||
private $incrementalCopy;
|
||||
private $rangeContentMD5;
|
||||
private $accessTier;
|
||||
private $accessTierInferred;
|
||||
private $accessTierChangeTime;
|
||||
private $archiveStatus;
|
||||
private $deletedTime;
|
||||
private $remainingRetentionDays;
|
||||
|
||||
/**
|
||||
* Creates BlobProperties object from $parsed response in array representation of XML elements
|
||||
*
|
||||
* @param array $parsed parsed response in array format.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return BlobProperties
|
||||
*/
|
||||
public static function createFromXml(array $parsed)
|
||||
{
|
||||
$result = new BlobProperties();
|
||||
$clean = array_change_key_case($parsed);
|
||||
|
||||
$result->setCommonBlobProperties($clean);
|
||||
$result->setLeaseStatus(Utilities::tryGetValue($clean, 'leasestatus'));
|
||||
$result->setLeaseState(Utilities::tryGetValue($clean, 'leasestate'));
|
||||
$result->setLeaseDuration(Utilities::tryGetValue($clean, 'leaseduration'));
|
||||
$result->setCopyState(CopyState::createFromXml($clean));
|
||||
|
||||
$result->setIncrementalCopy(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValue($clean, 'incrementalcopy'),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$result->setAccessTier((
|
||||
Utilities::tryGetValue($clean, 'accesstier')
|
||||
));
|
||||
|
||||
$result->setAccessTierInferred(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValue($clean, 'accesstierinferred'),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$accesstierchangetime = Utilities::tryGetValue($clean, 'accesstierchangetime');
|
||||
if (!is_null($accesstierchangetime)) {
|
||||
$accesstierchangetime = Utilities::rfc1123ToDateTime($accesstierchangetime);
|
||||
$result->setAccessTierChangeTime($accesstierchangetime);
|
||||
}
|
||||
|
||||
$result->setArchiveStatus(
|
||||
Utilities::tryGetValue($clean, 'archivestatus')
|
||||
);
|
||||
|
||||
$deletedtime = Utilities::tryGetValue($clean, 'deletedtime');
|
||||
if (!is_null($deletedtime)) {
|
||||
$deletedtime = Utilities::rfc1123ToDateTime($deletedtime);
|
||||
$result->setDeletedTime($deletedtime);
|
||||
}
|
||||
|
||||
$remainingretentiondays = Utilities::tryGetValue($clean, 'remainingretentiondays');
|
||||
if (!is_null($remainingretentiondays)) {
|
||||
$result->setRemainingRetentionDays((int) $remainingretentiondays);
|
||||
}
|
||||
|
||||
$creationtime = Utilities::tryGetValue($clean, 'creation-time');
|
||||
if (!is_null($creationtime)) {
|
||||
$creationtime = Utilities::rfc1123ToDateTime($creationtime);
|
||||
$result->setCreationTime($creationtime);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates BlobProperties object from $parsed response in array representation of http headers
|
||||
*
|
||||
* @param array $parsed parsed response in array format.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return BlobProperties
|
||||
*/
|
||||
public static function createFromHttpHeaders(array $parsed)
|
||||
{
|
||||
$result = new BlobProperties();
|
||||
$clean = array_change_key_case($parsed);
|
||||
|
||||
$result->setCommonBlobProperties($clean);
|
||||
|
||||
$result->setBlobType(Utilities::tryGetValue($clean, Resources::X_MS_BLOB_TYPE));
|
||||
$result->setLeaseStatus(Utilities::tryGetValue($clean, Resources::X_MS_LEASE_STATUS));
|
||||
$result->setLeaseState(Utilities::tryGetValue($clean, Resources::X_MS_LEASE_STATE));
|
||||
$result->setLeaseDuration(Utilities::tryGetValue($clean, Resources::X_MS_LEASE_DURATION));
|
||||
$result->setCopyState(CopyState::createFromHttpHeaders($clean));
|
||||
|
||||
$result->setServerEncrypted(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValue(
|
||||
$clean,
|
||||
Resources::X_MS_SERVER_ENCRYPTED
|
||||
),
|
||||
true
|
||||
)
|
||||
);
|
||||
$result->setIncrementalCopy(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValue(
|
||||
$clean,
|
||||
Resources::X_MS_INCREMENTAL_COPY
|
||||
),
|
||||
true
|
||||
)
|
||||
);
|
||||
$result->setCommittedBlockCount(
|
||||
intval(Utilities::tryGetValue(
|
||||
$clean,
|
||||
Resources::X_MS_BLOB_COMMITTED_BLOCK_COUNT
|
||||
))
|
||||
);
|
||||
$result->setCopyDestinationSnapshot(
|
||||
Utilities::tryGetValue(
|
||||
$clean,
|
||||
Resources::X_MS_COPY_DESTINATION_SNAPSHOT
|
||||
)
|
||||
);
|
||||
|
||||
$result->setAccessTier((
|
||||
Utilities::tryGetValue($clean, Resources::X_MS_ACCESS_TIER)
|
||||
));
|
||||
|
||||
$result->setAccessTierInferred(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValue($clean, Resources::X_MS_ACCESS_TIER_INFERRED),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$date = Utilities::tryGetValue($clean, Resources::X_MS_ACCESS_TIER_CHANGE_TIME);
|
||||
if (!is_null($date)) {
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$result->setAccessTierChangeTime($date);
|
||||
}
|
||||
|
||||
$result->setArchiveStatus(
|
||||
Utilities::tryGetValue($clean, Resources::X_MS_ARCHIVE_STATUS)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob creationTime.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getCreationTime()
|
||||
{
|
||||
return $this->creationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob creationTime.
|
||||
*
|
||||
* @param \DateTime $creationTime value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCreationTime(\DateTime $creationTime)
|
||||
{
|
||||
Validate::isDate($creationTime);
|
||||
$this->creationTime = $creationTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentType.
|
||||
*
|
||||
* @param string $contentType value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentType($contentType)
|
||||
{
|
||||
$this->contentType = $contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentRange.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentRange()
|
||||
{
|
||||
return $this->contentRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentRange.
|
||||
*
|
||||
* @param string $contentRange value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentRange($contentRange)
|
||||
{
|
||||
$this->contentRange = $contentRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentLength.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getContentLength()
|
||||
{
|
||||
return $this->contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentLength.
|
||||
*
|
||||
* @param integer $contentLength value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLength($contentLength)
|
||||
{
|
||||
Validate::isInteger($contentLength, 'contentLength');
|
||||
$this->contentLength = $contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentEncoding.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentEncoding()
|
||||
{
|
||||
return $this->contentEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentEncoding.
|
||||
*
|
||||
* @param string $contentEncoding value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentEncoding($contentEncoding)
|
||||
{
|
||||
$this->contentEncoding = $contentEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob access tier.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessTier()
|
||||
{
|
||||
return $this->accessTier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob access tier.
|
||||
*
|
||||
* @param string $accessTier value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessTier($accessTier)
|
||||
{
|
||||
$this->accessTier = $accessTier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob archive status.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getArchiveStatus()
|
||||
{
|
||||
return $this->archiveStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob archive status.
|
||||
*
|
||||
* @param string $archiveStatus value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setArchiveStatus($archiveStatus)
|
||||
{
|
||||
$this->archiveStatus = $archiveStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob deleted time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDeletedTime()
|
||||
{
|
||||
return $this->deletedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob deleted time.
|
||||
*
|
||||
* @param \DateTime $deletedTime value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDeletedTime(\DateTime $deletedTime)
|
||||
{
|
||||
$this->deletedTime = $deletedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob remaining retention days.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getRemainingRetentionDays()
|
||||
{
|
||||
return $this->remainingRetentionDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob remaining retention days.
|
||||
*
|
||||
* @param integer $remainingRetentionDays value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRemainingRetentionDays($remainingRetentionDays)
|
||||
{
|
||||
$this->remainingRetentionDays = $remainingRetentionDays;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets blob access inferred.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAccessTierInferred()
|
||||
{
|
||||
return $this->accessTierInferred;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob access tier inferred.
|
||||
*
|
||||
* @param boolean $accessTierInferred value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessTierInferred($accessTierInferred)
|
||||
{
|
||||
Validate::isBoolean($accessTierInferred);
|
||||
$this->accessTierInferred = $accessTierInferred;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob access tier change time.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getAccessTierChangeTime()
|
||||
{
|
||||
return $this->accessTierChangeTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob access tier change time.
|
||||
*
|
||||
* @param \DateTime $accessTierChangeTime value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessTierChangeTime(\DateTime $accessTierChangeTime)
|
||||
{
|
||||
Validate::isDate($accessTierChangeTime);
|
||||
$this->accessTierChangeTime = $accessTierChangeTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentLanguage.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentLanguage()
|
||||
{
|
||||
return $this->contentLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentLanguage.
|
||||
*
|
||||
* @param string $contentLanguage value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLanguage($contentLanguage)
|
||||
{
|
||||
$this->contentLanguage = $contentLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob range contentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRangeContentMD5()
|
||||
{
|
||||
return $this->rangeContentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob range contentMD5.
|
||||
*
|
||||
* @param string rangeContentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRangeContentMD5($rangeContentMD5)
|
||||
{
|
||||
$this->rangeContentMD5 = $rangeContentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob cacheControl.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheControl()
|
||||
{
|
||||
return $this->cacheControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob cacheControl.
|
||||
*
|
||||
* @param string $cacheControl value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCacheControl($cacheControl)
|
||||
{
|
||||
$this->cacheControl = $cacheControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentDisposition.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentDisposition()
|
||||
{
|
||||
return $this->contentDisposition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentDisposition.
|
||||
*
|
||||
* @param string $contentDisposition value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentDisposition($contentDisposition)
|
||||
{
|
||||
$this->contentDisposition = $contentDisposition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob blobType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBlobType()
|
||||
{
|
||||
return $this->blobType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob blobType.
|
||||
*
|
||||
* @param string $blobType value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBlobType($blobType)
|
||||
{
|
||||
$this->blobType = $blobType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob leaseStatus.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseStatus()
|
||||
{
|
||||
return $this->leaseStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob leaseStatus.
|
||||
*
|
||||
* @param string $leaseStatus value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseStatus($leaseStatus)
|
||||
{
|
||||
$this->leaseStatus = $leaseStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lease state.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseState()
|
||||
{
|
||||
return $this->leaseState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lease state.
|
||||
*
|
||||
* @param string $leaseState value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseState($leaseState)
|
||||
{
|
||||
$this->leaseState = $leaseState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lease duration.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseDuration()
|
||||
{
|
||||
return $this->leaseDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob leaseStatus.
|
||||
*
|
||||
* @param string $leaseDuration value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseDuration($leaseDuration)
|
||||
{
|
||||
$this->leaseDuration = $leaseDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob sequenceNumber.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSequenceNumber()
|
||||
{
|
||||
return $this->sequenceNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob sequenceNumber.
|
||||
*
|
||||
* @param int $sequenceNumber value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSequenceNumber($sequenceNumber)
|
||||
{
|
||||
Validate::isInteger($sequenceNumber, 'sequenceNumber');
|
||||
$this->sequenceNumber = $sequenceNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the server encryption status of the blob.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getServerEncrypted()
|
||||
{
|
||||
return $this->serverEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the server encryption status of the blob.
|
||||
*
|
||||
* @param boolean $serverEncrypted
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setServerEncrypted($serverEncrypted)
|
||||
{
|
||||
$this->serverEncrypted = $serverEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of committed blocks present in the blob.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getCommittedBlockCount()
|
||||
{
|
||||
return $this->committedBlockCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of committed blocks present in the blob.
|
||||
*
|
||||
* @param int $committedBlockCount the number of committed blocks present in the blob.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCommittedBlockCount($committedBlockCount)
|
||||
{
|
||||
$this->committedBlockCount = $committedBlockCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy state of the blob.
|
||||
*
|
||||
* @return CopyState
|
||||
*/
|
||||
public function getCopyState()
|
||||
{
|
||||
return $this->copyState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the copy state of the blob.
|
||||
*
|
||||
* @param CopyState $copyState the copy state of the blob.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCopyState($copyState)
|
||||
{
|
||||
$this->copyState = $copyState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets snapshot time of the last successful incremental copy snapshot for this blob.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCopyDestinationSnapshot()
|
||||
{
|
||||
return $this->copyDestinationSnapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets snapshot time of the last successful incremental copy snapshot for this blob.
|
||||
*
|
||||
* @param string $copyDestinationSnapshot last successful incremental copy snapshot.
|
||||
*/
|
||||
public function setCopyDestinationSnapshot($copyDestinationSnapshot)
|
||||
{
|
||||
$this->copyDestinationSnapshot = $copyDestinationSnapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the blob is an incremental copy blob.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncrementalCopy()
|
||||
{
|
||||
return $this->incrementalCopy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the blob is an incremental copy blob.
|
||||
*
|
||||
* @param boolean $incrementalCopy whether blob is an incremental copy blob.
|
||||
*/
|
||||
public function setIncrementalCopy($incrementalCopy)
|
||||
{
|
||||
$this->incrementalCopy = $incrementalCopy;
|
||||
}
|
||||
|
||||
private function setCommonBlobProperties(array $clean)
|
||||
{
|
||||
$date = Utilities::tryGetValue($clean, Resources::LAST_MODIFIED);
|
||||
if (!is_null($date)) {
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$this->setLastModified($date);
|
||||
}
|
||||
|
||||
$this->setBlobType(Utilities::tryGetValue($clean, 'blobtype'));
|
||||
|
||||
$this->setContentLength(intval($clean[Resources::CONTENT_LENGTH]));
|
||||
$this->setETag(Utilities::tryGetValue($clean, Resources::ETAG));
|
||||
$this->setSequenceNumber(
|
||||
intval(
|
||||
Utilities::tryGetValue($clean, Resources::X_MS_BLOB_SEQUENCE_NUMBER)
|
||||
)
|
||||
);
|
||||
$this->setContentRange(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_RANGE)
|
||||
);
|
||||
$this->setCacheControl(
|
||||
Utilities::tryGetValue($clean, Resources::CACHE_CONTROL)
|
||||
);
|
||||
$this->setContentDisposition(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_DISPOSITION)
|
||||
);
|
||||
$this->setContentEncoding(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_ENCODING)
|
||||
);
|
||||
$this->setContentLanguage(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_LANGUAGE)
|
||||
);
|
||||
$this->setContentType(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_TYPE_LOWER_CASE)
|
||||
);
|
||||
|
||||
if (Utilities::tryGetValue($clean, Resources::CONTENT_MD5) &&
|
||||
!Utilities::tryGetValue($clean, Resources::CONTENT_RANGE)
|
||||
) {
|
||||
$this->setContentMD5(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_MD5)
|
||||
);
|
||||
} else {
|
||||
$this->setContentMD5(
|
||||
Utilities::tryGetValue($clean, Resources::BLOB_CONTENT_MD5)
|
||||
);
|
||||
$this->setRangeContentMD5(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_MD5)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Models\ServiceOptions;
|
||||
|
||||
/**
|
||||
* Blob service options.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobServiceOptions extends ServiceOptions
|
||||
{
|
||||
private $_leaseId;
|
||||
private $_accessConditions;
|
||||
|
||||
/**
|
||||
* Gets lease Id for the blob
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseId()
|
||||
{
|
||||
return $this->_leaseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets lease Id for the blob
|
||||
*
|
||||
* @param string $leaseId the blob lease id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseId($leaseId)
|
||||
{
|
||||
$this->_leaseId = $leaseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets access condition
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\AccessCondition[]
|
||||
*/
|
||||
public function getAccessConditions()
|
||||
{
|
||||
return $this->_accessConditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets access condition
|
||||
*
|
||||
* @param mixed $accessConditions value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessConditions($accessConditions)
|
||||
{
|
||||
if (!is_null($accessConditions) &&
|
||||
is_array($accessConditions)) {
|
||||
$this->_accessConditions = $accessConditions;
|
||||
} else {
|
||||
$this->_accessConditions = [$accessConditions];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Encapsulates blob types
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlobType
|
||||
{
|
||||
const BLOCK_BLOB = 'BlockBlob';
|
||||
const PAGE_BLOB = 'PageBlob';
|
||||
const APPEND_BLOB = 'AppendBlob';
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Holds information about blob block.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class Block
|
||||
{
|
||||
private $_blockId;
|
||||
private $_type;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $blockId The ID of this block.
|
||||
* @param string $type The type of the block.
|
||||
*/
|
||||
public function __construct($blockId = '', $type = '')
|
||||
{
|
||||
$this->_blockId = $blockId;
|
||||
$this->_type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the blockId.
|
||||
*
|
||||
* @param string $blockId The id of the block.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBlockId($blockId)
|
||||
{
|
||||
$this->_blockId = $blockId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the blockId.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockId()
|
||||
{
|
||||
return $this->_blockId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type.
|
||||
*
|
||||
* @param string $type The type of the block.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->_type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer;
|
||||
|
||||
/**
|
||||
* Holds block list used for commitBlobBlocks
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BlockList
|
||||
{
|
||||
private $entries;
|
||||
private static $xmlRootName = 'BlockList';
|
||||
|
||||
/**
|
||||
* Creates block list from array of blocks.
|
||||
*
|
||||
* @param Block[] The blocks array.
|
||||
*
|
||||
* @return BlockList
|
||||
*/
|
||||
public static function create(array $array)
|
||||
{
|
||||
$blockList = new BlockList();
|
||||
|
||||
foreach ($array as $value) {
|
||||
$blockList->addEntry($value->getBlockId(), $value->getType());
|
||||
}
|
||||
|
||||
return $blockList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new entry to the block list entries.
|
||||
*
|
||||
* @param string $blockId The block id.
|
||||
* @param string $type The entry type, you can use BlobBlockType.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addEntry($blockId, $type)
|
||||
{
|
||||
Validate::canCastAsString($blockId, 'blockId');
|
||||
Validate::isTrue(
|
||||
BlobBlockType::isValid($type),
|
||||
sprintf(Resources::INVALID_BTE_MSG, get_class(new BlobBlockType()))
|
||||
);
|
||||
$block = new Block();
|
||||
$block->setBlockId($blockId);
|
||||
$block->setType($type);
|
||||
|
||||
$this->entries[] = $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Addds committed block entry.
|
||||
*
|
||||
* @param string $blockId The block id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addCommittedEntry($blockId)
|
||||
{
|
||||
$this->addEntry($blockId, BlobBlockType::COMMITTED_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Addds uncommitted block entry.
|
||||
*
|
||||
* @param string $blockId The block id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addUncommittedEntry($blockId)
|
||||
{
|
||||
$this->addEntry($blockId, BlobBlockType::UNCOMMITTED_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Addds latest block entry.
|
||||
*
|
||||
* @param string $blockId The block id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addLatestEntry($blockId)
|
||||
{
|
||||
$this->addEntry($blockId, BlobBlockType::LATEST_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob block entry.
|
||||
*
|
||||
* @param string $blockId The id of the block.
|
||||
*
|
||||
* @return Block
|
||||
*/
|
||||
public function getEntry($blockId)
|
||||
{
|
||||
foreach ($this->entries as $value) {
|
||||
if ($blockId == $value->getBlockId()) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all blob block entries.
|
||||
*
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getEntries()
|
||||
{
|
||||
return $this->entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the BlockList object to XML representation
|
||||
*
|
||||
* @param XmlSerializer $xmlSerializer The XML serializer.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toXml(XmlSerializer $xmlSerializer)
|
||||
{
|
||||
$properties = array(XmlSerializer::ROOT_NAME => self::$xmlRootName);
|
||||
$array = array();
|
||||
|
||||
foreach ($this->entries as $value) {
|
||||
$array[] = array(
|
||||
$value->getType() => $value->getBlockId()
|
||||
);
|
||||
}
|
||||
|
||||
return $xmlSerializer->serialize($array, $properties);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* The result of calling breakLease API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class BreakLeaseResult
|
||||
{
|
||||
private $_leaseTime;
|
||||
|
||||
/**
|
||||
* Creates BreakLeaseResult from response headers
|
||||
*
|
||||
* @param array $headers response headers
|
||||
*
|
||||
* @return BreakLeaseResult
|
||||
*/
|
||||
public static function create($headers)
|
||||
{
|
||||
$result = new BreakLeaseResult();
|
||||
|
||||
$result->setLeaseTime(
|
||||
Utilities::tryGetValue($headers, Resources::X_MS_LEASE_TIME)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets lease time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseTime()
|
||||
{
|
||||
return $this->_leaseTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets lease time.
|
||||
*
|
||||
* @param string $leaseTime the blob lease time.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLeaseTime($leaseTime)
|
||||
{
|
||||
$this->_leaseTime = $leaseTime;
|
||||
}
|
||||
}
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for commitBlobBlocks
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CommitBlobBlocksOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_contentType;
|
||||
private $_contentEncoding;
|
||||
private $_contentLanguage;
|
||||
private $_contentMD5;
|
||||
private $_cacheControl;
|
||||
private $_contentDisposition;
|
||||
private $_metadata;
|
||||
|
||||
/**
|
||||
* Gets ContentType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->_contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ContentType.
|
||||
*
|
||||
* @param string $contentType value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentType($contentType)
|
||||
{
|
||||
$this->_contentType = $contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ContentEncoding.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentEncoding()
|
||||
{
|
||||
return $this->_contentEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ContentEncoding.
|
||||
*
|
||||
* @param string $contentEncoding value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentEncoding($contentEncoding)
|
||||
{
|
||||
$this->_contentEncoding = $contentEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ContentLanguage.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentLanguage()
|
||||
{
|
||||
return $this->_contentLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ContentLanguage.
|
||||
*
|
||||
* @param string $contentLanguage value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLanguage($contentLanguage)
|
||||
{
|
||||
$this->_contentLanguage = $contentLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ContentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->_contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ContentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets cache control.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheControl()
|
||||
{
|
||||
return $this->_cacheControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets cacheControl.
|
||||
*
|
||||
* @param string $cacheControl value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCacheControl($cacheControl)
|
||||
{
|
||||
$this->_cacheControl = $cacheControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets content disposition.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentDisposition()
|
||||
{
|
||||
return $this->_contentDisposition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contentDisposition.
|
||||
*
|
||||
* @param string $contentDisposition value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentDisposition($contentDisposition)
|
||||
{
|
||||
$this->_contentDisposition = $contentDisposition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->_metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob metadata.
|
||||
*
|
||||
* @param array $metadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata = null)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a instance using the given options
|
||||
* @param mixed $options Input options
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function create($options)
|
||||
{
|
||||
$result = new CommitBlobBlocksOptions();
|
||||
$result->setContentType($options->getContentType());
|
||||
$result->setContentEncoding($options->getContentEncoding());
|
||||
$result->setContentLanguage($options->getContentLanguage());
|
||||
$result->setContentMD5($options->getContentMD5());
|
||||
$result->setCacheControl($options->getCacheControl());
|
||||
$result->setContentDisposition($options->getContentDisposition());
|
||||
$result->setMetadata($options->getMetadata());
|
||||
$result->setLeaseId($options->getLeaseId());
|
||||
$result->setAccessConditions($options->getAccessConditions());
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* WindowsAzure container object.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class Container
|
||||
{
|
||||
private $_name;
|
||||
private $_url;
|
||||
private $_metadata;
|
||||
private $_properties;
|
||||
|
||||
/**
|
||||
* Gets container name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container name.
|
||||
*
|
||||
* @param string $name value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container url.
|
||||
*
|
||||
* @param string $url value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->_url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->_metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container metadata.
|
||||
*
|
||||
* @param array $metadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata = null)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container properties
|
||||
*
|
||||
* @return ContainerProperties
|
||||
*/
|
||||
public function getProperties()
|
||||
{
|
||||
return $this->_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container properties
|
||||
*
|
||||
* @param ContainerProperties $properties container properties
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setProperties(ContainerProperties $properties)
|
||||
{
|
||||
$this->_properties = $properties;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\ACLBase;
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* Holds container ACL members.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ContainerACL extends ACLBase
|
||||
{
|
||||
private $publicAccess;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//setting the resource type to a default value.
|
||||
$this->setResourceType(Resources::RESOURCE_TYPE_CONTAINER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given array into signed identifiers and create an instance of
|
||||
* ContainerACL
|
||||
*
|
||||
* @param string $publicAccess The container public access.
|
||||
* @param array $parsed The parsed response into array representation.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return ContainerACL
|
||||
*/
|
||||
public static function create($publicAccess, array $parsed = null)
|
||||
{
|
||||
Validate::isTrue(
|
||||
PublicAccessType::isValid($publicAccess),
|
||||
Resources::INVALID_BLOB_PAT_MSG
|
||||
);
|
||||
$result = new ContainerACL();
|
||||
$result->fromXmlArray($parsed);
|
||||
$result->setPublicAccess($publicAccess);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container publicAccess.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPublicAccess()
|
||||
{
|
||||
return $this->publicAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container publicAccess.
|
||||
*
|
||||
* @param string $publicAccess value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPublicAccess($publicAccess)
|
||||
{
|
||||
Validate::isTrue(
|
||||
PublicAccessType::isValid($publicAccess),
|
||||
Resources::INVALID_BLOB_PAT_MSG
|
||||
);
|
||||
$this->publicAccess = $publicAccess;
|
||||
$this->setResourceType(
|
||||
self::getResourceTypeByPublicAccess($publicAccess)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the resource type according to the given public access. Default
|
||||
* value is Resources::RESOURCE_TYPE_CONTAINER.
|
||||
*
|
||||
* @param string $publicAccess The public access that determines the
|
||||
* resource type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function getResourceTypeByPublicAccess($publicAccess)
|
||||
{
|
||||
$result = '';
|
||||
|
||||
switch ($publicAccess) {
|
||||
case PublicAccessType::BLOBS_ONLY:
|
||||
$result = Resources::RESOURCE_TYPE_BLOB;
|
||||
break;
|
||||
case PublicAccessType::CONTAINER_AND_BLOBS:
|
||||
$result = Resources::RESOURCE_TYPE_CONTAINER;
|
||||
break;
|
||||
default:
|
||||
$result = Resources::RESOURCE_TYPE_CONTAINER;
|
||||
break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate if the resource type is for the class.
|
||||
*
|
||||
* @param string $resourceType the resource type to be validated.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function validateResourceType($resourceType)
|
||||
{
|
||||
Validate::isTrue(
|
||||
$resourceType == Resources::RESOURCE_TYPE_BLOB ||
|
||||
$resourceType == Resources::RESOURCE_TYPE_CONTAINER,
|
||||
Resources::INVALID_RESOURCE_TYPE
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a ContainerAccessPolicy object.
|
||||
*
|
||||
* @return ContainerAccessPolicy
|
||||
*/
|
||||
protected static function createAccessPolicy()
|
||||
{
|
||||
return new ContainerAccessPolicy();
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources;
|
||||
use MicrosoftAzure\Storage\Common\Models\AccessPolicy;
|
||||
|
||||
/**
|
||||
* Holds access policy elements
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ContainerAccessPolicy extends AccessPolicy
|
||||
{
|
||||
/**
|
||||
* Get the valid permissions for the given resource.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getResourceValidPermissions()
|
||||
{
|
||||
return BlobResources::ACCESS_PERMISSIONS[
|
||||
BlobResources::RESOURCE_TYPE_CONTAINER
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(BlobResources::RESOURCE_TYPE_CONTAINER);
|
||||
}
|
||||
}
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* Holds container properties fields
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ContainerProperties
|
||||
{
|
||||
private $etag;
|
||||
private $lastModified;
|
||||
private $leaseDuration;
|
||||
private $leaseStatus;
|
||||
private $leaseState;
|
||||
private $publicAccess;
|
||||
|
||||
/**
|
||||
* Gets container lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setETag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob leaseStatus.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseStatus()
|
||||
{
|
||||
return $this->leaseStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob leaseStatus.
|
||||
*
|
||||
* @param string $leaseStatus value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseStatus($leaseStatus)
|
||||
{
|
||||
$this->leaseStatus = $leaseStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lease state.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseState()
|
||||
{
|
||||
return $this->leaseState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lease state.
|
||||
*
|
||||
* @param string $leaseState value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseState($leaseState)
|
||||
{
|
||||
$this->leaseState = $leaseState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lease duration.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseDuration()
|
||||
{
|
||||
return $this->leaseDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob leaseStatus.
|
||||
*
|
||||
* @param string $leaseDuration value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseDuration($leaseDuration)
|
||||
{
|
||||
$this->leaseDuration = $leaseDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container publicAccess.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPublicAccess()
|
||||
{
|
||||
return $this->publicAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container publicAccess.
|
||||
*
|
||||
* @param string $publicAccess value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPublicAccess($publicAccess)
|
||||
{
|
||||
Validate::isTrue(
|
||||
PublicAccessType::isValid($publicAccess),
|
||||
Resources::INVALID_BLOB_PAT_MSG
|
||||
);
|
||||
$this->publicAccess = $publicAccess;
|
||||
}
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* optional parameters for CopyBlobOptions wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CopyBlobFromURLOptions extends BlobServiceOptions
|
||||
{
|
||||
use AccessTierTrait;
|
||||
|
||||
private $sourceLeaseId;
|
||||
private $sourceAccessConditions;
|
||||
private $metadata;
|
||||
private $isIncrementalCopy;
|
||||
|
||||
/**
|
||||
* Gets source access condition
|
||||
*
|
||||
* @return AccessCondition[]
|
||||
*/
|
||||
public function getSourceAccessConditions()
|
||||
{
|
||||
return $this->sourceAccessConditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets source access condition
|
||||
*
|
||||
* @param array $sourceAccessConditions value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSourceAccessConditions($sourceAccessConditions)
|
||||
{
|
||||
if (!is_null($sourceAccessConditions) &&
|
||||
is_array($sourceAccessConditions)) {
|
||||
$this->sourceAccessConditions = $sourceAccessConditions;
|
||||
} else {
|
||||
$this->sourceAccessConditions = [$sourceAccessConditions];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets metadata.
|
||||
*
|
||||
* @param array $metadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets source lease ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceLeaseId()
|
||||
{
|
||||
return $this->sourceLeaseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets source lease ID.
|
||||
*
|
||||
* @param string $sourceLeaseId value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSourceLeaseId($sourceLeaseId)
|
||||
{
|
||||
$this->sourceLeaseId = $sourceLeaseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets isIncrementalCopy.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsIncrementalCopy()
|
||||
{
|
||||
return $this->isIncrementalCopy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets isIncrementalCopy.
|
||||
*
|
||||
* @param boolean $isIncrementalCopy
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIsIncrementalCopy($isIncrementalCopy)
|
||||
{
|
||||
$this->isIncrementalCopy = $isIncrementalCopy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* optional parameters for CopyBlobOptions wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CopyBlobOptions extends CopyBlobFromURLOptions
|
||||
{
|
||||
private $sourceSnapshot;
|
||||
|
||||
/**
|
||||
* Gets source snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceSnapshot()
|
||||
{
|
||||
return $this->sourceSnapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets source snapshot.
|
||||
*
|
||||
* @param string $sourceSnapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSourceSnapshot($sourceSnapshot)
|
||||
{
|
||||
$this->sourceSnapshot = $sourceSnapshot;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* The result of calling copyBlob API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CopyBlobResult
|
||||
{
|
||||
private $_etag;
|
||||
private $_lastModified;
|
||||
private $_copyId;
|
||||
private $_copyStatus;
|
||||
|
||||
/**
|
||||
* Creates CopyBlobResult object from the response of the copy blob request.
|
||||
*
|
||||
* @param array $headers The HTTP response headers in array representation.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return CopyBlobResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new CopyBlobResult();
|
||||
$result->setETag(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
)
|
||||
);
|
||||
$result->setCopyId(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_COPY_ID,
|
||||
$headers
|
||||
)
|
||||
);
|
||||
$result->setCopyStatus(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_COPY_STATUS,
|
||||
$headers
|
||||
)
|
||||
);
|
||||
if (Utilities::arrayKeyExistsInsensitive(Resources::LAST_MODIFIED, $headers)) {
|
||||
$lastModified = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$result->setLastModified(Utilities::rfc1123ToDateTime($lastModified));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCopyId()
|
||||
{
|
||||
return $this->_copyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets copy Id
|
||||
*
|
||||
* @param string $copyId the blob copy id.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setCopyId($copyId)
|
||||
{
|
||||
$this->_copyId = $copyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy status
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCopyStatus()
|
||||
{
|
||||
return $this->_copyStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets copy status
|
||||
*
|
||||
* @param string $status the copy status.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setCopyStatus($copystatus)
|
||||
{
|
||||
$this->_copyStatus = $copystatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ETag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->_etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ETag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->_lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Represents blob copy state
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CopyState
|
||||
{
|
||||
private $_copyId;
|
||||
private $_completionTime;
|
||||
private $_status;
|
||||
private $_statusDescription;
|
||||
private $_source;
|
||||
private $_bytesCopied;
|
||||
private $_totalBytes;
|
||||
|
||||
/**
|
||||
* Creates CopyState object from $parsed response in array representation of XML elements
|
||||
*
|
||||
* @param array $parsed parsed response in array format.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\CopyState
|
||||
*/
|
||||
public static function createFromXml(array $parsed)
|
||||
{
|
||||
$result = new CopyState();
|
||||
$clean = array_change_key_case($parsed);
|
||||
|
||||
$copyCompletionTime = Utilities::tryGetValue($clean, 'copycompletiontime');
|
||||
if (!is_null($copyCompletionTime)) {
|
||||
$copyCompletionTime = Utilities::rfc1123ToDateTime($copyCompletionTime);
|
||||
$result->setCompletionTime($copyCompletionTime);
|
||||
}
|
||||
|
||||
$result->setCopyId(Utilities::tryGetValue($clean, 'copyid'));
|
||||
$result->setStatus(Utilities::tryGetValue($clean, 'copystatus'));
|
||||
$result->setStatusDescription(Utilities::tryGetValue($clean, 'copystatusdescription'));
|
||||
$result->setSource(Utilities::tryGetValue($clean, 'copysource'));
|
||||
|
||||
$copyProgress = Utilities::tryGetValue($clean, 'copyprogress');
|
||||
|
||||
if (!is_null($copyProgress) && strpos($copyProgress, '/') !== false) {
|
||||
$parts = explode('/', $copyProgress);
|
||||
$bytesCopied = intval($parts[0]);
|
||||
$totalBytes = intval($parts[1]);
|
||||
|
||||
$result->setBytesCopied($bytesCopied);
|
||||
$result->setTotalBytes($totalBytes);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates CopyState object from $parsed response in array representation of http headers
|
||||
*
|
||||
* @param array $parsed parsed response in array format.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\CopyState
|
||||
*/
|
||||
public static function createFromHttpHeaders(array $parsed)
|
||||
{
|
||||
$result = new CopyState();
|
||||
$clean = array_change_key_case($parsed);
|
||||
|
||||
$copyCompletionTime = Utilities::tryGetValue($clean, Resources::X_MS_COPY_COMPLETION_TIME);
|
||||
if (!is_null($copyCompletionTime)) {
|
||||
$copyCompletionTime = Utilities::rfc1123ToDateTime($copyCompletionTime);
|
||||
$result->setCompletionTime($copyCompletionTime);
|
||||
}
|
||||
|
||||
$result->setCopyId(Utilities::tryGetValue($clean, Resources::X_MS_COPY_ID));
|
||||
$result->setStatus(Utilities::tryGetValue($clean, Resources::X_MS_COPY_STATUS));
|
||||
$result->setStatusDescription(Utilities::tryGetValue($clean, Resources::X_MS_COPY_STATUS_DESCRIPTION));
|
||||
$result->setSource(Utilities::tryGetValue($clean, Resources::X_MS_COPY_SOURCE));
|
||||
|
||||
$copyProgress = Utilities::tryGetValue($clean, Resources::X_MS_COPY_PROGRESS);
|
||||
if (!is_null($copyProgress) && strpos($copyProgress, '/') !== false) {
|
||||
$parts = explode('/', $copyProgress);
|
||||
$bytesCopied = intval($parts[0]);
|
||||
$totalBytes = intval($parts[1]);
|
||||
|
||||
$result->setBytesCopied($bytesCopied);
|
||||
$result->setTotalBytes($totalBytes);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy Id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCopyId()
|
||||
{
|
||||
return $this->_copyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets copy Id
|
||||
*
|
||||
* @param string $copyId the blob copy id.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setCopyId($copyId)
|
||||
{
|
||||
$this->_copyId = $copyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy completion time
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getCompletionTime()
|
||||
{
|
||||
return $this->_completionTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets copy completion time
|
||||
*
|
||||
* @param \DateTime $completionTime the copy completion time.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setCompletionTime($completionTime)
|
||||
{
|
||||
$this->_completionTime = $completionTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy status
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets copy status
|
||||
*
|
||||
* @param string $status the copy status.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setStatus($status)
|
||||
{
|
||||
$this->_status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy status description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusDescription()
|
||||
{
|
||||
return $this->_statusDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets copy status description
|
||||
*
|
||||
* @param string $statusDescription the copy status description.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setStatusDescription($statusDescription)
|
||||
{
|
||||
$this->_statusDescription = $statusDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets copy source
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->_source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets copy source
|
||||
*
|
||||
* @param string $source the copy source.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setSource($source)
|
||||
{
|
||||
$this->_source = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets bytes copied
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBytesCopied()
|
||||
{
|
||||
return $this->_bytesCopied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets bytes copied
|
||||
*
|
||||
* @param int $bytesCopied the bytes copied.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setBytesCopied($bytesCopied)
|
||||
{
|
||||
$this->_bytesCopied = $bytesCopied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets total bytes to be copied
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTotalBytes()
|
||||
{
|
||||
return $this->_bytesCopied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets total bytes to be copied
|
||||
*
|
||||
* @param int $totalBytes the bytes copied.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setTotalBytes($totalBytes)
|
||||
{
|
||||
$this->_totalBytes = $totalBytes;
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for createBlobBlock wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateBlobBlockOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_contentMD5;
|
||||
private $_numberOfConcurrency;
|
||||
|
||||
/**
|
||||
* Gets blob contentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->_contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of concurrency for sending a blob.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNumberOfConcurrency()
|
||||
{
|
||||
return $this->_numberOfConcurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number of concurrency for sending a blob.
|
||||
*
|
||||
* @param int $numberOfConcurrency the number of concurrent requests.
|
||||
*/
|
||||
public function setNumberOfConcurrency($numberOfConcurrency)
|
||||
{
|
||||
$this->_numberOfConcurrency = $numberOfConcurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a CreateBlobBlockOptions object from a createBlobOptions.
|
||||
*
|
||||
* @param CreateBlobOptions $createBlobOptions
|
||||
*
|
||||
* @return CreateBlobBlockOptions
|
||||
*/
|
||||
public static function create(CreateBlobOptions $createBlobOptions)
|
||||
{
|
||||
$result = new CreateBlobBlockOptions();
|
||||
$result->setTimeout($createBlobOptions->getTimeout());
|
||||
$result->setLeaseId($createBlobOptions->getLeaseId());
|
||||
$result->setNumberOfConcurrency(
|
||||
$createBlobOptions->getNumberOfConcurrency()
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* optional parameters for createXXXBlob wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateBlobOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_contentType;
|
||||
private $_contentEncoding;
|
||||
private $_contentLanguage;
|
||||
private $_contentMD5;
|
||||
private $_cacheControl;
|
||||
private $_contentDisposition;
|
||||
private $_metadata;
|
||||
private $_sequenceNumber;
|
||||
private $_numberOfConcurrency;
|
||||
|
||||
/**
|
||||
* Gets blob contentType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->_contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentType.
|
||||
*
|
||||
* @param string $contentType value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentType($contentType)
|
||||
{
|
||||
$this->_contentType = $contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets contentEncoding.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentEncoding()
|
||||
{
|
||||
return $this->_contentEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contentEncoding.
|
||||
*
|
||||
* @param string $contentEncoding value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentEncoding($contentEncoding)
|
||||
{
|
||||
$this->_contentEncoding = $contentEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets contentLanguage.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentLanguage()
|
||||
{
|
||||
return $this->_contentLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contentLanguage.
|
||||
*
|
||||
* @param string $contentLanguage value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLanguage($contentLanguage)
|
||||
{
|
||||
$this->_contentLanguage = $contentLanguage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets contentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->_contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets cacheControl.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheControl()
|
||||
{
|
||||
return $this->_cacheControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets cacheControl.
|
||||
*
|
||||
* @param string $cacheControl value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCacheControl($cacheControl)
|
||||
{
|
||||
$this->_cacheControl = $cacheControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets content disposition.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentDisposition()
|
||||
{
|
||||
return $this->_contentDisposition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets content disposition.
|
||||
*
|
||||
* @param string $contentDisposition value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentDisposition($contentDisposition)
|
||||
{
|
||||
$this->_contentDisposition = $contentDisposition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->_metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob metadata.
|
||||
*
|
||||
* @param array $metadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob sequenceNumber.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSequenceNumber()
|
||||
{
|
||||
return $this->_sequenceNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob sequenceNumber.
|
||||
*
|
||||
* @param int $sequenceNumber value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSequenceNumber($sequenceNumber)
|
||||
{
|
||||
Validate::isInteger($sequenceNumber, 'sequenceNumber');
|
||||
$this->_sequenceNumber = $sequenceNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets number of concurrency for sending a blob.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNumberOfConcurrency()
|
||||
{
|
||||
return $this->_numberOfConcurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets number of concurrency for sending a blob.
|
||||
*
|
||||
* @param int $numberOfConcurrency the number of concurrent requests.
|
||||
*/
|
||||
public function setNumberOfConcurrency($numberOfConcurrency)
|
||||
{
|
||||
$this->_numberOfConcurrency = $numberOfConcurrency;
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for create and clear blob pages
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateBlobPagesOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_contentMD5;
|
||||
|
||||
/**
|
||||
* Gets blob contentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->_contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_contentMD5 = $contentMD5;
|
||||
}
|
||||
}
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Holds result of calling create or clear blob pages
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateBlobPagesResult
|
||||
{
|
||||
private $contentMD5;
|
||||
private $etag;
|
||||
private $lastModified;
|
||||
private $requestServerEncrypted;
|
||||
private $sequenceNumber;
|
||||
|
||||
/**
|
||||
* Creates CreateBlobPagesResult object from $parsed response in array
|
||||
* representation
|
||||
*
|
||||
* @param array $headers HTTP response headers
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return CreateBlobPagesResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new CreateBlobPagesResult();
|
||||
$clean = array_change_key_case($headers);
|
||||
|
||||
$date = $clean[Resources::LAST_MODIFIED];
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$result->setETag($clean[Resources::ETAG]);
|
||||
$result->setLastModified($date);
|
||||
|
||||
$result->setContentMD5(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_MD5)
|
||||
);
|
||||
|
||||
$result->setRequestServerEncrypted(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_REQUEST_SERVER_ENCRYPTED,
|
||||
$headers
|
||||
),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$result->setSequenceNumber(
|
||||
intval(
|
||||
Utilities::tryGetValue(
|
||||
$clean,
|
||||
Resources::X_MS_BLOB_SEQUENCE_NUMBER
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime.
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified($lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::canCastAsString($etag, 'etag');
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentMD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the whether the contents of the request are successfully encrypted.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRequestServerEncrypted()
|
||||
{
|
||||
return $this->requestServerEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request server encryption value.
|
||||
*
|
||||
* @param boolean $requestServerEncrypted
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRequestServerEncrypted($requestServerEncrypted)
|
||||
{
|
||||
$this->requestServerEncrypted = $requestServerEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob sequenceNumber.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSequenceNumber()
|
||||
{
|
||||
return $this->sequenceNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob sequenceNumber.
|
||||
*
|
||||
* @param int $sequenceNumber value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setSequenceNumber($sequenceNumber)
|
||||
{
|
||||
Validate::isInteger($sequenceNumber, 'sequenceNumber');
|
||||
$this->sequenceNumber = $sequenceNumber;
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* The optional parameters for createBlobSnapshot wrapper.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateBlobSnapshotOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_metadata;
|
||||
|
||||
/**
|
||||
* Gets metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->_metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets metadata.
|
||||
*
|
||||
* @param array $metadata The metadata array.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* The result of creating Blob snapshot.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateBlobSnapshotResult
|
||||
{
|
||||
private $_snapshot;
|
||||
private $_etag;
|
||||
private $_lastModified;
|
||||
|
||||
/**
|
||||
* Creates CreateBlobSnapshotResult object from the response of the
|
||||
* create Blob snapshot request.
|
||||
*
|
||||
* @param array $headers The HTTP response headers in array representation.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return CreateBlobSnapshotResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new CreateBlobSnapshotResult();
|
||||
$headerWithLowerCaseKey = array_change_key_case($headers);
|
||||
|
||||
$result->setETag($headerWithLowerCaseKey[Resources::ETAG]);
|
||||
|
||||
$result->setLastModified(
|
||||
Utilities::rfc1123ToDateTime(
|
||||
$headerWithLowerCaseKey[Resources::LAST_MODIFIED]
|
||||
)
|
||||
);
|
||||
|
||||
$result->setSnapshot($headerWithLowerCaseKey[Resources::X_MS_SNAPSHOT]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->_snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setSnapshot($snapshot)
|
||||
{
|
||||
$this->_snapshot = $snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ETag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->_etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ETag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->_lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified($lastModified)
|
||||
{
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Models\TransactionalMD5Trait;
|
||||
|
||||
/**
|
||||
* Optional parameters for CreateBlockBlob.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateBlockBlobOptions extends CreateBlobOptions
|
||||
{
|
||||
use TransactionalMD5Trait;
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* Optional parameters for createContainer API
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreateContainerOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_publicAccess;
|
||||
private $_metadata;
|
||||
|
||||
/**
|
||||
* Gets container public access.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPublicAccess()
|
||||
{
|
||||
return $this->_publicAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies whether data in the container may be accessed publicly and the level
|
||||
* of access. Possible values include:
|
||||
* 1) container: Specifies full public read access for container and blob data.
|
||||
* Clients can enumerate blobs within the container via anonymous request, but
|
||||
* cannot enumerate containers within the storage account.
|
||||
* 2) blob: Specifies public read access for blobs. Blob data within this
|
||||
* container can be read via anonymous request, but container data is not
|
||||
* available. Clients cannot enumerate blobs within the container via
|
||||
* anonymous request.
|
||||
* If this value is not specified in the request, container data is private to
|
||||
* the account owner.
|
||||
*
|
||||
* @param string $publicAccess access modifier for the container
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPublicAccess($publicAccess)
|
||||
{
|
||||
Validate::canCastAsString($publicAccess, 'publicAccess');
|
||||
$this->_publicAccess = $publicAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user defined metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->_metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user defined metadata. This metadata should be added without the header
|
||||
* prefix (x-ms-meta-*).
|
||||
*
|
||||
* @param array $metadata user defined metadata object in array form.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadata(array $metadata)
|
||||
{
|
||||
$this->_metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new metadata element. This element should be added without the header
|
||||
* prefix (x-ms-meta-*).
|
||||
*
|
||||
* @param string $key metadata key element.
|
||||
* @param string $value metadata value element.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addMetadata($key, $value)
|
||||
{
|
||||
$this->_metadata[$key] = $value;
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Models\TransactionalMD5Trait;
|
||||
|
||||
/**
|
||||
* Optional parameters for createPageBlobFromContent.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreatePageBlobFromContentOptions extends CreatePageBlobOptions
|
||||
{
|
||||
use TransactionalMD5Trait;
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for CreatePageBlob.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class CreatePageBlobOptions extends CreateBlobOptions
|
||||
{
|
||||
use AccessTierTrait;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* Optional parameters for deleteBlob wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class DeleteBlobOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_snapshot;
|
||||
private $_deleteSnaphotsOnly;
|
||||
|
||||
/**
|
||||
* Gets blob snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->_snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
{
|
||||
$this->_snapshot = $snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob deleteSnaphotsOnly.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getDeleteSnaphotsOnly()
|
||||
{
|
||||
return $this->_deleteSnaphotsOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob deleteSnaphotsOnly.
|
||||
*
|
||||
* @param string $deleteSnaphotsOnly value.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function setDeleteSnaphotsOnly($deleteSnaphotsOnly)
|
||||
{
|
||||
Validate::isBoolean($deleteSnaphotsOnly);
|
||||
$this->_deleteSnaphotsOnly = $deleteSnaphotsOnly;
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for getBlobMetadata wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetBlobMetadataOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_snapshot;
|
||||
|
||||
/**
|
||||
* Gets blob snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->_snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
{
|
||||
$this->_snapshot = $snapshot;
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\MetadataTrait;
|
||||
|
||||
/**
|
||||
* Holds results of calling getBlobMetadata wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetBlobMetadataResult
|
||||
{
|
||||
use MetadataTrait;
|
||||
|
||||
/**
|
||||
* Creates the instance from the parsed headers.
|
||||
*
|
||||
* @param array $parsed Parsed headers
|
||||
*
|
||||
* @return GetBlobMetadataResult
|
||||
*/
|
||||
public static function create(array $parsed)
|
||||
{
|
||||
return static::createMetadataResult($parsed);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Models\Range;
|
||||
|
||||
/**
|
||||
* Optional parameters for getBlob wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetBlobOptions extends BlobServiceOptions
|
||||
{
|
||||
private $snapshot;
|
||||
private $range;
|
||||
private $rangeGetContentMD5;
|
||||
|
||||
/**
|
||||
* Gets blob snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
{
|
||||
$this->snapshot = $snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Blob range.
|
||||
*
|
||||
* @return Range
|
||||
*/
|
||||
public function getRange()
|
||||
{
|
||||
return $this->range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Blob range.
|
||||
*
|
||||
* @param Range $range value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRange(Range $range)
|
||||
{
|
||||
$this->range = $range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets rangeGetContentMD5
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRangeGetContentMD5()
|
||||
{
|
||||
return $this->rangeGetContentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets rangeGetContentMD5
|
||||
*
|
||||
* @param boolean $rangeGetContentMD5 value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRangeGetContentMD5($rangeGetContentMD5)
|
||||
{
|
||||
Validate::isBoolean($rangeGetContentMD5);
|
||||
$this->rangeGetContentMD5 = $rangeGetContentMD5;
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for getBlobProperties wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetBlobPropertiesOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_snapshot;
|
||||
|
||||
/**
|
||||
* Gets blob snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->_snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
{
|
||||
$this->_snapshot = $snapshot;
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\MetadataTrait;
|
||||
|
||||
/**
|
||||
* Holds result of calling getBlobProperties
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetBlobPropertiesResult
|
||||
{
|
||||
use MetadataTrait;
|
||||
|
||||
private $_properties;
|
||||
|
||||
/**
|
||||
* Gets blob properties.
|
||||
*
|
||||
* @return BlobProperties
|
||||
*/
|
||||
public function getProperties()
|
||||
{
|
||||
return $this->_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob properties.
|
||||
*
|
||||
* @param BlobProperties $properties value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setProperties($properties)
|
||||
{
|
||||
$this->_properties = $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a instance using the given headers.
|
||||
*
|
||||
* @param array $headers response headers parsed in an array
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return GetBlobPropertiesResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = static::createMetadataResult($headers);
|
||||
|
||||
$result->setProperties(BlobProperties::createFromHttpHeaders($headers));
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
/**
|
||||
* Holds result of GetBlob API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetBlobResult
|
||||
{
|
||||
private $properties;
|
||||
private $metadata;
|
||||
private $contentStream;
|
||||
|
||||
/**
|
||||
* Creates GetBlobResult from getBlob call.
|
||||
*
|
||||
* @param array $headers The HTTP response headers.
|
||||
* @param StreamInterface $body The response body.
|
||||
* @param array $metadata The blob metadata.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return GetBlobResult
|
||||
*/
|
||||
public static function create(
|
||||
array $headers,
|
||||
StreamInterface $body,
|
||||
array $metadata
|
||||
) {
|
||||
$result = new GetBlobResult();
|
||||
$result->setContentStream($body->detach());
|
||||
$result->setProperties(BlobProperties::createFromHttpHeaders($headers));
|
||||
$result->setMetadata(is_null($metadata) ? array() : $metadata);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob metadata.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob metadata.
|
||||
*
|
||||
* @param array $metadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setMetadata(array $metadata)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob properties.
|
||||
*
|
||||
* @return BlobProperties
|
||||
*/
|
||||
public function getProperties()
|
||||
{
|
||||
return $this->properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob properties.
|
||||
*
|
||||
* @param BlobProperties $properties value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setProperties(BlobProperties $properties)
|
||||
{
|
||||
$this->properties = $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentStream.
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public function getContentStream()
|
||||
{
|
||||
return $this->contentStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentStream.
|
||||
*
|
||||
* @param resource $contentStream The stream handle.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentStream($contentStream)
|
||||
{
|
||||
$this->contentStream = $contentStream;
|
||||
}
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Holds container ACL
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetContainerACLResult
|
||||
{
|
||||
private $containerACL;
|
||||
private $lastModified;
|
||||
|
||||
private $etag;
|
||||
|
||||
/**
|
||||
* Parses the given array into signed identifiers
|
||||
*
|
||||
* @param string $publicAccess container public access
|
||||
* @param string $etag container etag
|
||||
* @param \DateTime $lastModified last modification date
|
||||
* @param array $parsed parsed response into array
|
||||
* representation
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function create(
|
||||
$publicAccess,
|
||||
$etag,
|
||||
\DateTime $lastModified,
|
||||
array $parsed = null
|
||||
) {
|
||||
$result = new GetContainerAclResult();
|
||||
$result->setETag($etag);
|
||||
$result->setLastModified($lastModified);
|
||||
$acl = ContainerACL::create($publicAccess, $parsed);
|
||||
$result->setContainerAcl($acl);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container ACL
|
||||
*
|
||||
* @return ContainerACL
|
||||
*/
|
||||
public function getContainerAcl()
|
||||
{
|
||||
return $this->containerACL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container ACL
|
||||
*
|
||||
* @param ContainerACL $containerACL value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContainerAcl(ContainerACL $containerACL)
|
||||
{
|
||||
$this->containerACL = $containerACL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container lastModified.
|
||||
*
|
||||
* @return \DateTime.
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
}
|
||||
}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\MetadataTrait;
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* Holds result of getContainerProperties and getContainerMetadata
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class GetContainerPropertiesResult
|
||||
{
|
||||
use MetadataTrait;
|
||||
|
||||
private $leaseStatus;
|
||||
private $leaseState;
|
||||
private $leaseDuration;
|
||||
private $publicAccess;
|
||||
|
||||
/**
|
||||
* Gets blob leaseStatus.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseStatus()
|
||||
{
|
||||
return $this->leaseStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob leaseStatus.
|
||||
*
|
||||
* @param string $leaseStatus value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseStatus($leaseStatus)
|
||||
{
|
||||
$this->leaseStatus = $leaseStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lease state.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseState()
|
||||
{
|
||||
return $this->leaseState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lease state.
|
||||
*
|
||||
* @param string $leaseState value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseState($leaseState)
|
||||
{
|
||||
$this->leaseState = $leaseState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lease duration.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseDuration()
|
||||
{
|
||||
return $this->leaseDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob leaseStatus.
|
||||
*
|
||||
* @param string $leaseDuration value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLeaseDuration($leaseDuration)
|
||||
{
|
||||
$this->leaseDuration = $leaseDuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container publicAccess.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPublicAccess()
|
||||
{
|
||||
return $this->publicAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container publicAccess.
|
||||
*
|
||||
* @param string $publicAccess value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPublicAccess($publicAccess)
|
||||
{
|
||||
Validate::isTrue(
|
||||
PublicAccessType::isValid($publicAccess),
|
||||
Resources::INVALID_BLOB_PAT_MSG
|
||||
);
|
||||
$this->publicAccess = $publicAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance using the response headers from the API call.
|
||||
*
|
||||
* @param array $responseHeaders The array contains all the response headers
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return GetContainerPropertiesResult
|
||||
*/
|
||||
public static function create(array $responseHeaders)
|
||||
{
|
||||
$result = static::createMetadataResult($responseHeaders);
|
||||
|
||||
$result->setLeaseStatus(Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_LEASE_STATUS,
|
||||
$responseHeaders
|
||||
));
|
||||
$result->setLeaseState(Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_LEASE_STATE,
|
||||
$responseHeaders
|
||||
));
|
||||
$result->setLeaseDuration(Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_LEASE_DURATION,
|
||||
$responseHeaders
|
||||
));
|
||||
$result->setPublicAccess(Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_BLOB_PUBLIC_ACCESS,
|
||||
$responseHeaders
|
||||
));
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Modes for leasing a blob
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class LeaseMode
|
||||
{
|
||||
const ACQUIRE_ACTION = 'acquire';
|
||||
const RENEW_ACTION = 'renew';
|
||||
const RELEASE_ACTION = 'release';
|
||||
const BREAK_ACTION = 'break';
|
||||
const CHANGE_ACTION = 'change';
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* The result of calling acquireLease API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class LeaseResult
|
||||
{
|
||||
private $leaseId;
|
||||
|
||||
/**
|
||||
* Creates LeaseResult from response headers
|
||||
*
|
||||
* @param array $headers response headers
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return \MicrosoftAzure\Storage\Blob\Models\LeaseResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new LeaseResult();
|
||||
|
||||
$result->setLeaseId(
|
||||
Utilities::tryGetValue($headers, Resources::X_MS_LEASE_ID)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets lease Id for the blob
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLeaseId()
|
||||
{
|
||||
return $this->leaseId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets lease Id for the blob
|
||||
*
|
||||
* @param string $leaseId the blob lease id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLeaseId($leaseId)
|
||||
{
|
||||
$this->leaseId = $leaseId;
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* Optional parameters for listBlobBlock wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListBlobBlocksOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_snapshot;
|
||||
private $_includeUncommittedBlobs;
|
||||
private $_includeCommittedBlobs;
|
||||
private static $_listType;
|
||||
|
||||
/**
|
||||
* Constructs the static variable $listType.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
self::$_listType[true][true] = 'all';
|
||||
self::$_listType[true][false] = 'uncommitted';
|
||||
self::$_listType[false][true] = 'committed';
|
||||
self::$_listType[false][false] = 'all';
|
||||
|
||||
$this->_includeUncommittedBlobs = false;
|
||||
$this->_includeCommittedBlobs = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->_snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
{
|
||||
$this->_snapshot = $snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include uncommittedBlobs flag.
|
||||
*
|
||||
* @param bool $includeUncommittedBlobs value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeUncommittedBlobs($includeUncommittedBlobs)
|
||||
{
|
||||
Validate::isBoolean($includeUncommittedBlobs);
|
||||
$this->_includeUncommittedBlobs = $includeUncommittedBlobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if uncommittedBlobs is included or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeUncommittedBlobs()
|
||||
{
|
||||
return $this->_includeUncommittedBlobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include committedBlobs flag.
|
||||
*
|
||||
* @param bool $includeCommittedBlobs value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeCommittedBlobs($includeCommittedBlobs)
|
||||
{
|
||||
Validate::isBoolean($includeCommittedBlobs);
|
||||
$this->_includeCommittedBlobs = $includeCommittedBlobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if committedBlobs is included or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeCommittedBlobs()
|
||||
{
|
||||
return $this->_includeCommittedBlobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets block list type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockListType()
|
||||
{
|
||||
$includeUncommitted = $this->_includeUncommittedBlobs;
|
||||
$includeCommitted = $this->_includeCommittedBlobs;
|
||||
|
||||
return self::$_listType[$includeUncommitted][$includeCommitted];
|
||||
}
|
||||
}
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Holds result of listBlobBlocks
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListBlobBlocksResult
|
||||
{
|
||||
private $lastModified;
|
||||
private $etag;
|
||||
private $contentType;
|
||||
private $contentLength;
|
||||
private $committedBlocks;
|
||||
private $uncommittedBlocks;
|
||||
|
||||
/**
|
||||
* Gets block entries from parsed response
|
||||
*
|
||||
* @param array $parsed HTTP response
|
||||
* @param string $type Block type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function getEntries(array $parsed, $type)
|
||||
{
|
||||
$entries = array();
|
||||
|
||||
if (is_array($parsed)) {
|
||||
$rawEntries = array();
|
||||
|
||||
if (array_key_exists($type, $parsed)
|
||||
&& is_array($parsed[$type])
|
||||
&& !empty($parsed[$type])
|
||||
) {
|
||||
$rawEntries = Utilities::getArray($parsed[$type]['Block']);
|
||||
}
|
||||
|
||||
foreach ($rawEntries as $value) {
|
||||
$entries[$value['Name']] = $value['Size'];
|
||||
}
|
||||
}
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates ListBlobBlocksResult from given response headers and parsed body
|
||||
*
|
||||
* @param array $headers HTTP response headers
|
||||
* @param array $parsed HTTP response body in array representation
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return ListBlobBlocksResult
|
||||
*/
|
||||
public static function create(array $headers, array $parsed)
|
||||
{
|
||||
$result = new ListBlobBlocksResult();
|
||||
$clean = array_change_key_case($headers);
|
||||
|
||||
$result->setETag(Utilities::tryGetValue($clean, Resources::ETAG));
|
||||
$date = Utilities::tryGetValue($clean, Resources::LAST_MODIFIED);
|
||||
if (!is_null($date)) {
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$result->setLastModified($date);
|
||||
}
|
||||
$result->setContentLength(
|
||||
intval(
|
||||
Utilities::tryGetValue($clean, Resources::X_MS_BLOB_CONTENT_LENGTH)
|
||||
)
|
||||
);
|
||||
$result->setContentType(
|
||||
Utilities::tryGetValue($clean, Resources::CONTENT_TYPE_LOWER_CASE)
|
||||
);
|
||||
|
||||
$result->uncommittedBlocks = self::getEntries(
|
||||
$parsed,
|
||||
'UncommittedBlocks'
|
||||
);
|
||||
$result->committedBlocks = self::getEntries($parsed, 'CommittedBlocks');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentType.
|
||||
*
|
||||
* @param string $contentType value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentType($contentType)
|
||||
{
|
||||
$this->contentType = $contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentLength.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getContentLength()
|
||||
{
|
||||
return $this->contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentLength.
|
||||
*
|
||||
* @param integer $contentLength value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentLength($contentLength)
|
||||
{
|
||||
Validate::isInteger($contentLength, 'contentLength');
|
||||
$this->contentLength = $contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets uncommitted blocks
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUncommittedBlocks()
|
||||
{
|
||||
return $this->uncommittedBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets uncommitted blocks
|
||||
*
|
||||
* @param array $uncommittedBlocks The uncommitted blocks entries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUncommittedBlocks(array $uncommittedBlocks)
|
||||
{
|
||||
$this->uncommittedBlocks = $uncommittedBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets committed blocks
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCommittedBlocks()
|
||||
{
|
||||
return $this->committedBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets committed blocks
|
||||
*
|
||||
* @param array $committedBlocks The committed blocks entries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setCommittedBlocks(array $committedBlocks)
|
||||
{
|
||||
$this->committedBlocks = $committedBlocks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
|
||||
|
||||
/**
|
||||
* Optional parameters for listBlobs API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListBlobsOptions extends BlobServiceOptions
|
||||
{
|
||||
use MarkerContinuationTokenTrait;
|
||||
|
||||
private $_prefix;
|
||||
private $_delimiter;
|
||||
private $_maxResults;
|
||||
private $_includeMetadata;
|
||||
private $_includeSnapshots;
|
||||
private $_includeUncommittedBlobs;
|
||||
private $_includeCopy;
|
||||
private $_includeDeleted;
|
||||
|
||||
/**
|
||||
* Gets prefix.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrefix()
|
||||
{
|
||||
return $this->_prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets prefix.
|
||||
*
|
||||
* @param string $prefix value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrefix($prefix)
|
||||
{
|
||||
Validate::canCastAsString($prefix, 'prefix');
|
||||
$this->_prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets delimiter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter()
|
||||
{
|
||||
return $this->_delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets prefix.
|
||||
*
|
||||
* @param string $delimiter value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDelimiter($delimiter)
|
||||
{
|
||||
Validate::canCastAsString($delimiter, 'delimiter');
|
||||
$this->_delimiter = $delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets max results.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaxResults()
|
||||
{
|
||||
return $this->_maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets max results.
|
||||
*
|
||||
* @param integer $maxResults value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMaxResults($maxResults)
|
||||
{
|
||||
Validate::isInteger($maxResults, 'maxResults');
|
||||
$this->_maxResults = $maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if metadata is included or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeMetadata()
|
||||
{
|
||||
return $this->_includeMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include metadata flag.
|
||||
*
|
||||
* @param bool $includeMetadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeMetadata($includeMetadata)
|
||||
{
|
||||
Validate::isBoolean($includeMetadata);
|
||||
$this->_includeMetadata = $includeMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if snapshots is included or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeSnapshots()
|
||||
{
|
||||
return $this->_includeSnapshots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include snapshots flag.
|
||||
*
|
||||
* @param bool $includeSnapshots value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeSnapshots($includeSnapshots)
|
||||
{
|
||||
Validate::isBoolean($includeSnapshots);
|
||||
$this->_includeSnapshots = $includeSnapshots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if uncommittedBlobs is included or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeUncommittedBlobs()
|
||||
{
|
||||
return $this->_includeUncommittedBlobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include uncommittedBlobs flag.
|
||||
*
|
||||
* @param bool $includeUncommittedBlobs value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeUncommittedBlobs($includeUncommittedBlobs)
|
||||
{
|
||||
Validate::isBoolean($includeUncommittedBlobs);
|
||||
$this->_includeUncommittedBlobs = $includeUncommittedBlobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if copy is included or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeCopy()
|
||||
{
|
||||
return $this->_includeCopy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include copy flag.
|
||||
*
|
||||
* @param bool $includeCopy value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeCopy($includeCopy)
|
||||
{
|
||||
Validate::isBoolean($includeCopy);
|
||||
$this->_includeCopy = $includeCopy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if deleted is included or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIncludeDeleted()
|
||||
{
|
||||
return $this->_includeDeleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include deleted flag.
|
||||
*
|
||||
* @param bool $includeDeleted value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeDeleted($includeDeleted)
|
||||
{
|
||||
Validate::isBoolean($includeDeleted);
|
||||
$this->_includeDeleted = $includeDeleted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
|
||||
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
|
||||
|
||||
/**
|
||||
* Hold result of calliing listBlobs wrapper.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListBlobsResult
|
||||
{
|
||||
use MarkerContinuationTokenTrait;
|
||||
|
||||
private $blobPrefixes;
|
||||
private $blobs;
|
||||
private $delimiter;
|
||||
private $prefix;
|
||||
private $marker;
|
||||
private $maxResults;
|
||||
private $containerName;
|
||||
|
||||
/**
|
||||
* Creates ListBlobsResult object from parsed XML response.
|
||||
*
|
||||
* @param array $parsed XML response parsed into array.
|
||||
* @param string $location Contains the location for the previous
|
||||
* request.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return ListBlobsResult
|
||||
*/
|
||||
public static function create(array $parsed, $location = '')
|
||||
{
|
||||
$result = new ListBlobsResult();
|
||||
$serviceEndpoint = Utilities::tryGetKeysChainValue(
|
||||
$parsed,
|
||||
Resources::XTAG_ATTRIBUTES,
|
||||
Resources::XTAG_SERVICE_ENDPOINT
|
||||
);
|
||||
$containerName = Utilities::tryGetKeysChainValue(
|
||||
$parsed,
|
||||
Resources::XTAG_ATTRIBUTES,
|
||||
Resources::XTAG_CONTAINER_NAME
|
||||
);
|
||||
$result->setContainerName($containerName);
|
||||
$result->setPrefix(Utilities::tryGetValue(
|
||||
$parsed,
|
||||
Resources::QP_PREFIX
|
||||
));
|
||||
$result->setMarker(Utilities::tryGetValue(
|
||||
$parsed,
|
||||
Resources::QP_MARKER
|
||||
));
|
||||
|
||||
$nextMarker =
|
||||
Utilities::tryGetValue($parsed, Resources::QP_NEXT_MARKER);
|
||||
|
||||
if ($nextMarker != null) {
|
||||
$result->setContinuationToken(
|
||||
new MarkerContinuationToken(
|
||||
$nextMarker,
|
||||
$location
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$result->setMaxResults(intval(
|
||||
Utilities::tryGetValue($parsed, Resources::QP_MAX_RESULTS, 0)
|
||||
));
|
||||
$result->setDelimiter(Utilities::tryGetValue(
|
||||
$parsed,
|
||||
Resources::QP_DELIMITER
|
||||
));
|
||||
$blobs = array();
|
||||
$blobPrefixes = array();
|
||||
$rawBlobs = array();
|
||||
$rawBlobPrefixes = array();
|
||||
|
||||
if (is_array($parsed['Blobs'])
|
||||
&& array_key_exists('Blob', $parsed['Blobs'])
|
||||
) {
|
||||
$rawBlobs = Utilities::getArray($parsed['Blobs']['Blob']);
|
||||
}
|
||||
|
||||
foreach ($rawBlobs as $value) {
|
||||
$blob = new Blob();
|
||||
$blob->setName($value['Name']);
|
||||
$blob->setUrl($serviceEndpoint . $containerName . '/' . $value['Name']);
|
||||
$blob->setSnapshot(Utilities::tryGetValue($value, 'Snapshot'));
|
||||
$blob->setProperties(
|
||||
BlobProperties::createFromXml(
|
||||
Utilities::tryGetValue($value, 'Properties')
|
||||
)
|
||||
);
|
||||
$blob->setMetadata(
|
||||
Utilities::tryGetValue($value, Resources::QP_METADATA, array())
|
||||
);
|
||||
|
||||
$blobs[] = $blob;
|
||||
}
|
||||
|
||||
if (is_array($parsed['Blobs'])
|
||||
&& array_key_exists('BlobPrefix', $parsed['Blobs'])
|
||||
) {
|
||||
$rawBlobPrefixes = Utilities::getArray($parsed['Blobs']['BlobPrefix']);
|
||||
}
|
||||
|
||||
foreach ($rawBlobPrefixes as $value) {
|
||||
$blobPrefix = new BlobPrefix();
|
||||
$blobPrefix->setName($value['Name']);
|
||||
|
||||
$blobPrefixes[] = $blobPrefix;
|
||||
}
|
||||
|
||||
$result->setBlobs($blobs);
|
||||
$result->setBlobPrefixes($blobPrefixes);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blobs.
|
||||
*
|
||||
* @return Blob[]
|
||||
*/
|
||||
public function getBlobs()
|
||||
{
|
||||
return $this->blobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blobs.
|
||||
*
|
||||
* @param Blob[] $blobs list of blobs
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setBlobs(array $blobs)
|
||||
{
|
||||
$this->blobs = array();
|
||||
foreach ($blobs as $blob) {
|
||||
$this->blobs[] = clone $blob;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blobPrefixes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBlobPrefixes()
|
||||
{
|
||||
return $this->blobPrefixes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blobPrefixes.
|
||||
*
|
||||
* @param array $blobPrefixes list of blobPrefixes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setBlobPrefixes(array $blobPrefixes)
|
||||
{
|
||||
$this->blobPrefixes = array();
|
||||
foreach ($blobPrefixes as $blob) {
|
||||
$this->blobPrefixes[] = clone $blob;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets prefix.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrefix()
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets prefix.
|
||||
*
|
||||
* @param string $prefix value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setPrefix($prefix)
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets prefix.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter()
|
||||
{
|
||||
return $this->delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets prefix.
|
||||
*
|
||||
* @param string $delimiter value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setDelimiter($delimiter)
|
||||
{
|
||||
$this->delimiter = $delimiter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets marker.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMarker()
|
||||
{
|
||||
return $this->marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets marker.
|
||||
*
|
||||
* @param string $marker value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setMarker($marker)
|
||||
{
|
||||
$this->marker = $marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets max results.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaxResults()
|
||||
{
|
||||
return $this->maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets max results.
|
||||
*
|
||||
* @param integer $maxResults value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setMaxResults($maxResults)
|
||||
{
|
||||
$this->maxResults = $maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets container name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContainerName()
|
||||
{
|
||||
return $this->containerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets container name.
|
||||
*
|
||||
* @param string $containerName value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContainerName($containerName)
|
||||
{
|
||||
$this->containerName = $containerName;
|
||||
}
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
|
||||
/**
|
||||
* Options for listBlobs API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListContainersOptions extends BlobServiceOptions
|
||||
{
|
||||
use MarkerContinuationTokenTrait;
|
||||
|
||||
private $_prefix;
|
||||
private $_maxResults;
|
||||
private $_includeMetadata;
|
||||
|
||||
/**
|
||||
* Gets prefix - filters the results to return only containers whose name
|
||||
* begins with the specified prefix.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrefix()
|
||||
{
|
||||
return $this->_prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets prefix - filters the results to return only containers whose name
|
||||
* begins with the specified prefix.
|
||||
*
|
||||
* @param string $prefix value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrefix($prefix)
|
||||
{
|
||||
Validate::canCastAsString($prefix, 'prefix');
|
||||
$this->_prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets max results which specifies the maximum number of containers to return.
|
||||
* If the request does not specify maxresults, or specifies a value
|
||||
* greater than 5,000, the server will return up to 5,000 items.
|
||||
* If the parameter is set to a value less than or equal to zero,
|
||||
* the server will return status code 400 (Bad Request).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMaxResults()
|
||||
{
|
||||
return $this->_maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets max results which specifies the maximum number of containers to return.
|
||||
* If the request does not specify maxresults, or specifies a value
|
||||
* greater than 5,000, the server will return up to 5,000 items.
|
||||
* If the parameter is set to a value less than or equal to zero,
|
||||
* the server will return status code 400 (Bad Request).
|
||||
*
|
||||
* @param string $maxResults value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMaxResults($maxResults)
|
||||
{
|
||||
Validate::canCastAsString($maxResults, 'maxResults');
|
||||
$this->_maxResults = $maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if metadata is included or not.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIncludeMetadata()
|
||||
{
|
||||
return $this->_includeMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the include metadata flag.
|
||||
*
|
||||
* @param bool $includeMetadata value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIncludeMetadata($includeMetadata)
|
||||
{
|
||||
Validate::isBoolean($includeMetadata);
|
||||
$this->_includeMetadata = $includeMetadata;
|
||||
}
|
||||
}
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Common\Models\MarkerContinuationToken;
|
||||
use MicrosoftAzure\Storage\Common\MarkerContinuationTokenTrait;
|
||||
|
||||
/**
|
||||
* Container to hold list container response object.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListContainersResult
|
||||
{
|
||||
use MarkerContinuationTokenTrait;
|
||||
|
||||
private $containers;
|
||||
private $prefix;
|
||||
private $marker;
|
||||
private $maxResults;
|
||||
private $accountName;
|
||||
|
||||
/**
|
||||
* Creates ListBlobResult object from parsed XML response.
|
||||
*
|
||||
* @param array $parsedResponse XML response parsed into array.
|
||||
* @param string $location Contains the location for the previous
|
||||
* request.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return ListContainersResult
|
||||
*/
|
||||
public static function create(array $parsedResponse, $location = '')
|
||||
{
|
||||
$result = new ListContainersResult();
|
||||
$serviceEndpoint = Utilities::tryGetKeysChainValue(
|
||||
$parsedResponse,
|
||||
Resources::XTAG_ATTRIBUTES,
|
||||
Resources::XTAG_SERVICE_ENDPOINT
|
||||
);
|
||||
$result->setAccountName(Utilities::tryParseAccountNameFromUrl(
|
||||
$serviceEndpoint
|
||||
));
|
||||
$result->setPrefix(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_PREFIX
|
||||
));
|
||||
$result->setMarker(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_MARKER
|
||||
));
|
||||
|
||||
$nextMarker =
|
||||
Utilities::tryGetValue($parsedResponse, Resources::QP_NEXT_MARKER);
|
||||
|
||||
if ($nextMarker != null) {
|
||||
$result->setContinuationToken(
|
||||
new MarkerContinuationToken(
|
||||
$nextMarker,
|
||||
$location
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$result->setMaxResults(Utilities::tryGetValue(
|
||||
$parsedResponse,
|
||||
Resources::QP_MAX_RESULTS
|
||||
));
|
||||
$containers = array();
|
||||
$rawContainer = array();
|
||||
|
||||
if (!empty($parsedResponse['Containers'])) {
|
||||
$containersArray = $parsedResponse['Containers']['Container'];
|
||||
$rawContainer = Utilities::getArray($containersArray);
|
||||
}
|
||||
|
||||
foreach ($rawContainer as $value) {
|
||||
$container = new Container();
|
||||
$container->setName($value['Name']);
|
||||
$container->setUrl($serviceEndpoint . $value['Name']);
|
||||
$container->setMetadata(
|
||||
Utilities::tryGetValue($value, Resources::QP_METADATA, array())
|
||||
);
|
||||
$properties = new ContainerProperties();
|
||||
$date = $value['Properties']['Last-Modified'];
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$properties->setLastModified($date);
|
||||
$properties->setETag(Utilities::tryGetValueInsensitive(Resources::ETAG, $value['Properties']));
|
||||
|
||||
if (array_key_exists('LeaseStatus', $value['Properties'])) {
|
||||
$properties->setLeaseStatus($value['Properties']['LeaseStatus']);
|
||||
}
|
||||
if (array_key_exists('LeaseState', $value['Properties'])) {
|
||||
$properties->setLeaseStatus($value['Properties']['LeaseState']);
|
||||
}
|
||||
if (array_key_exists('LeaseDuration', $value['Properties'])) {
|
||||
$properties->setLeaseStatus($value['Properties']['LeaseDuration']);
|
||||
}
|
||||
if (array_key_exists('PublicAccess', $value['Properties'])) {
|
||||
$properties->setPublicAccess($value['Properties']['PublicAccess']);
|
||||
}
|
||||
$container->setProperties($properties);
|
||||
$containers[] = $container;
|
||||
}
|
||||
$result->setContainers($containers);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets containers.
|
||||
*
|
||||
* @param array $containers list of containers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContainers(array $containers)
|
||||
{
|
||||
$this->containers = array();
|
||||
foreach ($containers as $container) {
|
||||
$this->containers[] = clone $container;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets containers.
|
||||
*
|
||||
* @return Container[]
|
||||
*/
|
||||
public function getContainers()
|
||||
{
|
||||
return $this->containers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets prefix.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrefix()
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets prefix.
|
||||
*
|
||||
* @param string $prefix value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setPrefix($prefix)
|
||||
{
|
||||
$this->prefix = $prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets marker.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMarker()
|
||||
{
|
||||
return $this->marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets marker.
|
||||
*
|
||||
* @param string $marker value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setMarker($marker)
|
||||
{
|
||||
$this->marker = $marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets max results.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMaxResults()
|
||||
{
|
||||
return $this->maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets max results.
|
||||
*
|
||||
* @param string $maxResults value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setMaxResults($maxResults)
|
||||
{
|
||||
$this->maxResults = $maxResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets account name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccountName()
|
||||
{
|
||||
return $this->accountName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets account name.
|
||||
*
|
||||
* @param string $accountName value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setAccountName($accountName)
|
||||
{
|
||||
$this->accountName = $accountName;
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Models\RangeDiff;
|
||||
|
||||
/**
|
||||
* Holds result of calling listPageBlobRangesDiff wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListPageBlobRangesDiffResult extends ListPageBlobRangesResult
|
||||
{
|
||||
/**
|
||||
* Creates ListPageBlobRangesDiffResult object from $parsed response in array representation
|
||||
*
|
||||
* @param array $headers HTTP response headers
|
||||
* @param array $parsed parsed response in array format.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return ListPageBlobRangesDiffResult
|
||||
*/
|
||||
public static function create(array $headers, array $parsed = null)
|
||||
{
|
||||
$result = new ListPageBlobRangesDiffResult();
|
||||
$headers = array_change_key_case($headers);
|
||||
|
||||
$date = $headers[Resources::LAST_MODIFIED];
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$blobLength = intval($headers[Resources::X_MS_BLOB_CONTENT_LENGTH]);
|
||||
|
||||
$result->setContentLength($blobLength);
|
||||
$result->setLastModified($date);
|
||||
$result->setETag($headers[Resources::ETAG]);
|
||||
|
||||
if (is_null($parsed)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
$parsed = array_change_key_case($parsed);
|
||||
|
||||
$rawRanges = array();
|
||||
if (!empty($parsed[strtolower(Resources::XTAG_PAGE_RANGE)])) {
|
||||
$rawRanges = Utilities::getArray($parsed[strtolower(Resources::XTAG_PAGE_RANGE)]);
|
||||
}
|
||||
|
||||
$pageRanges = array();
|
||||
foreach ($rawRanges as $value) {
|
||||
$pageRanges[] = new RangeDiff(
|
||||
intval($value[Resources::XTAG_RANGE_START]),
|
||||
intval($value[Resources::XTAG_RANGE_END])
|
||||
);
|
||||
}
|
||||
|
||||
$rawRanges = array();
|
||||
if (!empty($parsed[strtolower(Resources::XTAG_CLEAR_RANGE)])) {
|
||||
$rawRanges = Utilities::getArray($parsed[strtolower(Resources::XTAG_CLEAR_RANGE)]);
|
||||
}
|
||||
|
||||
foreach ($rawRanges as $value) {
|
||||
$pageRanges[] = new RangeDiff(
|
||||
intval($value[Resources::XTAG_RANGE_START]),
|
||||
intval($value[Resources::XTAG_RANGE_END]),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
$result->setRanges($pageRanges);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Models\Range;
|
||||
|
||||
/**
|
||||
* Optional parameters for listPageBlobRanges wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListPageBlobRangesOptions extends BlobServiceOptions
|
||||
{
|
||||
private $snapshot;
|
||||
private $range;
|
||||
private $_rangeStart;
|
||||
private $_rangeEnd;
|
||||
|
||||
/**
|
||||
* Gets blob snapshot.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSnapshot()
|
||||
{
|
||||
return $this->snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob snapshot.
|
||||
*
|
||||
* @param string $snapshot value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSnapshot($snapshot)
|
||||
{
|
||||
$this->snapshot = $snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Blob range.
|
||||
*
|
||||
* @return Range
|
||||
*/
|
||||
public function getRange()
|
||||
{
|
||||
return $this->range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Blob range.
|
||||
*
|
||||
* @param Range $range value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRange(Range $range)
|
||||
{
|
||||
$this->range = $range;
|
||||
}
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Models\Range;
|
||||
|
||||
/**
|
||||
* Holds result of calling listPageBlobRanges wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class ListPageBlobRangesResult
|
||||
{
|
||||
private $_lastModified;
|
||||
private $_etag;
|
||||
private $_contentLength;
|
||||
private $_pageRanges;
|
||||
|
||||
/**
|
||||
* Creates BlobProperties object from $parsed response in array representation
|
||||
*
|
||||
* @param array $headers HTTP response headers
|
||||
* @param array $parsed parsed response in array format.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return ListPageBlobRangesResult
|
||||
*/
|
||||
public static function create(array $headers, array $parsed = null)
|
||||
{
|
||||
$result = new ListPageBlobRangesResult();
|
||||
$headers = array_change_key_case($headers);
|
||||
|
||||
$date = $headers[Resources::LAST_MODIFIED];
|
||||
$date = Utilities::rfc1123ToDateTime($date);
|
||||
$blobLength = intval($headers[Resources::X_MS_BLOB_CONTENT_LENGTH]);
|
||||
$rawRanges = array();
|
||||
|
||||
if (!empty($parsed[Resources::XTAG_PAGE_RANGE])) {
|
||||
$parsed = array_change_key_case($parsed);
|
||||
$rawRanges = Utilities::getArray($parsed[strtolower(RESOURCES::XTAG_PAGE_RANGE)]);
|
||||
}
|
||||
|
||||
$pageRanges = array();
|
||||
foreach ($rawRanges as $value) {
|
||||
$pageRanges[] = new Range(
|
||||
intval($value[Resources::XTAG_RANGE_START]),
|
||||
intval($value[Resources::XTAG_RANGE_END])
|
||||
);
|
||||
}
|
||||
$result->setRanges($pageRanges);
|
||||
$result->setContentLength($blobLength);
|
||||
$result->setETag($headers[Resources::ETAG]);
|
||||
$result->setLastModified($date);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->_lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->_etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::canCastAsString($etag, 'etag');
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentLength.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getContentLength()
|
||||
{
|
||||
return $this->_contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentLength.
|
||||
*
|
||||
* @param integer $contentLength value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentLength($contentLength)
|
||||
{
|
||||
Validate::isInteger($contentLength, 'contentLength');
|
||||
$this->_contentLength = $contentLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets page ranges
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRanges()
|
||||
{
|
||||
return $this->_pageRanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets page ranges
|
||||
*
|
||||
* @param array $pageRanges page ranges to set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setRanges(array $pageRanges)
|
||||
{
|
||||
$this->_pageRanges = array();
|
||||
foreach ($pageRanges as $pageRange) {
|
||||
$this->_pageRanges[] = clone $pageRange;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Holds available blob page write options
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class PageWriteOption
|
||||
{
|
||||
const CLEAR_OPTION = 'clear';
|
||||
const UPDATE_OPTION = 'update';
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
|
||||
/**
|
||||
* Holds public access types for a container.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class PublicAccessType
|
||||
{
|
||||
const NONE = null;
|
||||
const BLOBS_ONLY = 'blob';
|
||||
const CONTAINER_AND_BLOBS = 'container';
|
||||
|
||||
/**
|
||||
* Validates the public access.
|
||||
*
|
||||
* @param string $type The public access type.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isValid($type)
|
||||
{
|
||||
// When $type is null, switch statement will take it
|
||||
// equal to self::NONE (EMPTY_STRING)
|
||||
switch ($type) {
|
||||
case self::NONE:
|
||||
case self::BLOBS_ONLY:
|
||||
case self::CONTAINER_AND_BLOBS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* The result of calling PutBlob API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2017 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class PutBlobResult
|
||||
{
|
||||
private $contentMD5;
|
||||
private $etag;
|
||||
private $lastModified;
|
||||
private $requestServerEncrypted;
|
||||
|
||||
/**
|
||||
* Creates PutBlobResult object from the response of the put blob request.
|
||||
*
|
||||
* @param array $headers The HTTP response headers in array representation.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return PutBlobResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new PutBlobResult();
|
||||
|
||||
$result->setETag(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
)
|
||||
);
|
||||
|
||||
if (Utilities::arrayKeyExistsInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
)) {
|
||||
$lastModified = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$result->setLastModified(Utilities::rfc1123ToDateTime($lastModified));
|
||||
}
|
||||
|
||||
$result->setContentMD5(
|
||||
Utilities::tryGetValueInsensitive(Resources::CONTENT_MD5, $headers)
|
||||
);
|
||||
|
||||
$result->setRequestServerEncrypted(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_REQUEST_SERVER_ENCRYPTED,
|
||||
$headers
|
||||
),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ETag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ETag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets block content MD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the content MD5 value.
|
||||
*
|
||||
* @param string $contentMD5 conent MD5 as a string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the whether the contents of the request are successfully encrypted.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRequestServerEncrypted()
|
||||
{
|
||||
return $this->requestServerEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request server encryption value.
|
||||
*
|
||||
* @param boolean $requestServerEncrypted
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRequestServerEncrypted($requestServerEncrypted)
|
||||
{
|
||||
$this->requestServerEncrypted = $requestServerEncrypted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* The result of calling PutBlock API.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class PutBlockResult
|
||||
{
|
||||
private $contentMD5;
|
||||
private $requestServerEncrypted;
|
||||
|
||||
/**
|
||||
* Creates PutBlockResult object from the response of the put block request.
|
||||
*
|
||||
* @param array $headers The HTTP response headers in array representation.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return PutBlockResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new PutBlockResult();
|
||||
|
||||
$result->setContentMD5(
|
||||
Utilities::tryGetValueInsensitive(Resources::CONTENT_MD5, $headers)
|
||||
);
|
||||
|
||||
$result->setRequestServerEncrypted(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_REQUEST_SERVER_ENCRYPTED,
|
||||
$headers
|
||||
),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets block content MD5.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the content MD5 value.
|
||||
*
|
||||
* @param string $contentMD5 conent MD5 as a string.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->contentMD5 = $contentMD5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the whether the contents of the request are successfully encrypted.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRequestServerEncrypted()
|
||||
{
|
||||
return $this->requestServerEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request server encryption value.
|
||||
*
|
||||
* @param boolean $requestServerEncrypted
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRequestServerEncrypted($requestServerEncrypted)
|
||||
{
|
||||
$this->requestServerEncrypted = $requestServerEncrypted;
|
||||
}
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Holds results of calling getBlobMetadata wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class SetBlobMetadataResult
|
||||
{
|
||||
private $etag;
|
||||
private $lastModified;
|
||||
private $requestServerEncrypted;
|
||||
|
||||
/**
|
||||
* Creates SetBlobMetadataResult from response headers.
|
||||
*
|
||||
* @param array $headers response headers
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return SetBlobMetadataResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new SetBlobMetadataResult();
|
||||
|
||||
$result->setETag(Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
));
|
||||
|
||||
$date = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$result->setLastModified(Utilities::rfc1123ToDateTime($date));
|
||||
|
||||
$result->setRequestServerEncrypted(
|
||||
Utilities::toBoolean(
|
||||
Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_REQUEST_SERVER_ENCRYPTED,
|
||||
$headers
|
||||
),
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::canCastAsString($etag, 'etag');
|
||||
$this->etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the whether the contents of the request are successfully encrypted.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRequestServerEncrypted()
|
||||
{
|
||||
return $this->requestServerEncrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the request server encryption value.
|
||||
*
|
||||
* @param boolean $requestServerEncrypted
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRequestServerEncrypted($requestServerEncrypted)
|
||||
{
|
||||
$this->requestServerEncrypted = $requestServerEncrypted;
|
||||
}
|
||||
}
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for setBlobProperties wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class SetBlobPropertiesOptions extends BlobServiceOptions
|
||||
{
|
||||
private $_blobProperties;
|
||||
private $_sequenceNumberAction;
|
||||
|
||||
/**
|
||||
* Creates a new SetBlobPropertiesOptions with a specified BlobProperties
|
||||
* instance.
|
||||
*
|
||||
* @param BlobProperties $blobProperties The blob properties instance.
|
||||
*/
|
||||
public function __construct(BlobProperties $blobProperties = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_blobProperties = is_null($blobProperties)
|
||||
? new BlobProperties() : clone $blobProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob sequenceNumber.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getSequenceNumber()
|
||||
{
|
||||
return $this->_blobProperties->getSequenceNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob sequenceNumber.
|
||||
*
|
||||
* @param integer $sequenceNumber value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSequenceNumber($sequenceNumber)
|
||||
{
|
||||
$this->_blobProperties->setSequenceNumber($sequenceNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets lease Id for the blob
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSequenceNumberAction()
|
||||
{
|
||||
return $this->_sequenceNumberAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets lease Id for the blob
|
||||
*
|
||||
* @param string $sequenceNumberAction action.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSequenceNumberAction($sequenceNumberAction)
|
||||
{
|
||||
$this->_sequenceNumberAction = $sequenceNumberAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob contentLength.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getContentLength()
|
||||
{
|
||||
return $this->_blobProperties->getContentLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob contentLength.
|
||||
*
|
||||
* @param integer $contentLength value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLength($contentLength)
|
||||
{
|
||||
$this->_blobProperties->setContentLength($contentLength);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ContentType.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->_blobProperties->getContentType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ContentType.
|
||||
*
|
||||
* @param string $contentType value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentType($contentType)
|
||||
{
|
||||
$this->_blobProperties->setContentType($contentType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ContentEncoding.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentEncoding()
|
||||
{
|
||||
return $this->_blobProperties->getContentEncoding();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ContentEncoding.
|
||||
*
|
||||
* @param string $contentEncoding value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentEncoding($contentEncoding)
|
||||
{
|
||||
$this->_blobProperties->setContentEncoding($contentEncoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ContentLanguage.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentLanguage()
|
||||
{
|
||||
return $this->_blobProperties->getContentLanguage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets ContentLanguage.
|
||||
*
|
||||
* @param string $contentLanguage value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentLanguage($contentLanguage)
|
||||
{
|
||||
$this->_blobProperties->setContentLanguage($contentLanguage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ContentMD5.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getContentMD5()
|
||||
{
|
||||
return $this->_blobProperties->getContentMD5();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob ContentMD5.
|
||||
*
|
||||
* @param string $contentMD5 value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentMD5($contentMD5)
|
||||
{
|
||||
$this->_blobProperties->setContentMD5($contentMD5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets cache control.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheControl()
|
||||
{
|
||||
return $this->_blobProperties->getCacheControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets cacheControl.
|
||||
*
|
||||
* @param string $cacheControl value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCacheControl($cacheControl)
|
||||
{
|
||||
$this->_blobProperties->setCacheControl($cacheControl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets content disposition.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContentDisposition()
|
||||
{
|
||||
return $this->_blobProperties->getContentDisposition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets contentDisposition.
|
||||
*
|
||||
* @param string $contentDisposition value to use.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setContentDisposition($contentDisposition)
|
||||
{
|
||||
$this->_blobProperties->setContentDisposition($contentDisposition);
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Blob\Internal\BlobResources as Resources;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Validate;
|
||||
use MicrosoftAzure\Storage\Common\Internal\Utilities;
|
||||
|
||||
/**
|
||||
* Holds result of calling setBlobProperties wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class SetBlobPropertiesResult
|
||||
{
|
||||
private $_lastModified;
|
||||
private $_etag;
|
||||
private $_sequenceNumber;
|
||||
|
||||
/**
|
||||
* Creates SetBlobPropertiesResult from response headers.
|
||||
*
|
||||
* @param array $headers response headers
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @return SetBlobPropertiesResult
|
||||
*/
|
||||
public static function create(array $headers)
|
||||
{
|
||||
$result = new SetBlobPropertiesResult();
|
||||
$date = Utilities::tryGetValueInsensitive(
|
||||
Resources::LAST_MODIFIED,
|
||||
$headers
|
||||
);
|
||||
$result->setLastModified(Utilities::rfc1123ToDateTime($date));
|
||||
$result->setETag(Utilities::tryGetValueInsensitive(
|
||||
Resources::ETAG,
|
||||
$headers
|
||||
));
|
||||
$result->setSequenceNumber(Utilities::tryGetValueInsensitive(
|
||||
Resources::X_MS_BLOB_SEQUENCE_NUMBER,
|
||||
$headers
|
||||
));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob lastModified.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getLastModified()
|
||||
{
|
||||
return $this->_lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob lastModified.
|
||||
*
|
||||
* @param \DateTime $lastModified value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setLastModified(\DateTime $lastModified)
|
||||
{
|
||||
Validate::isDate($lastModified);
|
||||
$this->_lastModified = $lastModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob etag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getETag()
|
||||
{
|
||||
return $this->_etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob etag.
|
||||
*
|
||||
* @param string $etag value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setETag($etag)
|
||||
{
|
||||
Validate::canCastAsString($etag, 'etag');
|
||||
$this->_etag = $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets blob sequenceNumber.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSequenceNumber()
|
||||
{
|
||||
return $this->_sequenceNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets blob sequenceNumber.
|
||||
*
|
||||
* @param int $sequenceNumber value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setSequenceNumber($sequenceNumber)
|
||||
{
|
||||
Validate::isInteger($sequenceNumber, 'sequenceNumber');
|
||||
$this->_sequenceNumber = $sequenceNumber;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
use MicrosoftAzure\Storage\Common\Models\ServiceOptions;
|
||||
|
||||
/**
|
||||
* Optional parameters for SetBlobTier.
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2018 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class SetBlobTierOptions extends ServiceOptions
|
||||
{
|
||||
use AccessTierTrait;
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* LICENSE: The MIT License (the "License")
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* https://github.com/azure/azure-storage-php/LICENSE
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
|
||||
namespace MicrosoftAzure\Storage\Blob\Models;
|
||||
|
||||
/**
|
||||
* Optional parameters for deleteBlob wrapper
|
||||
*
|
||||
* @category Microsoft
|
||||
* @package MicrosoftAzure\Storage\Blob\Models
|
||||
* @author Azure Storage PHP SDK <dmsh@microsoft.com>
|
||||
* @copyright 2016 Microsoft Corporation
|
||||
* @license https://github.com/azure/azure-storage-php/LICENSE
|
||||
* @link https://github.com/azure/azure-storage-php
|
||||
*/
|
||||
class UndeleteBlobOptions extends BlobServiceOptions
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user