Обновление клиента (apps, 3rdparty, install)

This commit is contained in:
root
2026-03-16 08:42:57 +00:00
parent b8905de237
commit f390426546
3354 changed files with 505213 additions and 3 deletions
@@ -0,0 +1,218 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\Internal\Resources;
/**
* Holds access policy elements
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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
*/
abstract class AccessPolicy
{
private $start;
private $expiry;
private $permission;
private $resourceType;
/**
* Get the valid permissions for the given resource.
*
* @return array
*/
abstract protected static function getResourceValidPermissions();
/**
* Constructor
*
* @param string $resourceType the resource type of this access policy.
*/
public function __construct($resourceType)
{
Validate::canCastAsString($resourceType, 'resourceType');
Validate::isTrue(
$resourceType == Resources::RESOURCE_TYPE_BLOB ||
$resourceType == Resources::RESOURCE_TYPE_CONTAINER ||
$resourceType == Resources::RESOURCE_TYPE_QUEUE ||
$resourceType == Resources::RESOURCE_TYPE_TABLE ||
$resourceType == Resources::RESOURCE_TYPE_FILE ||
$resourceType == Resources::RESOURCE_TYPE_SHARE,
Resources::ERROR_RESOURCE_TYPE_NOT_SUPPORTED
);
$this->resourceType = $resourceType;
}
/**
* Gets start.
*
* @return \DateTime.
*/
public function getStart()
{
return $this->start;
}
/**
* Sets start.
*
* @param \DateTime $start value.
*
* @return void
*/
public function setStart(\DateTime $start = null)
{
if ($start != null) {
Validate::isDate($start);
}
$this->start = $start;
}
/**
* Gets expiry.
*
* @return \DateTime.
*/
public function getExpiry()
{
return $this->expiry;
}
/**
* Sets expiry.
*
* @param \DateTime $expiry value.
*
* @return void
*/
public function setExpiry($expiry)
{
Validate::isDate($expiry);
$this->expiry = $expiry;
}
/**
* Gets permission.
*
* @return string.
*/
public function getPermission()
{
return $this->permission;
}
/**
* Sets permission.
*
* @param string $permission value.
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPermission($permission)
{
$this->permission = $this->validatePermission($permission);
}
/**
* Gets resource type.
*
* @return string.
*/
public function getResourceType()
{
return $this->resourceType;
}
/**
* Validate the permission against its corresponding allowed permissions
*
* @param string $permission The permission to be validated.
*
* @throws \InvalidArgumentException
*
* @return string
*/
private function validatePermission($permission)
{
$validPermissions = static::getResourceValidPermissions();
$result = '';
foreach ($validPermissions as $validPermission) {
if (strpos($permission, $validPermission) !== false) {
//append the valid permission to result.
$result .= $validPermission;
//remove all the character that represents the permission.
$permission = str_replace(
$validPermission,
'',
$permission
);
}
}
//After filtering all the permissions, if there is still characters
//left in the given permission, throw exception.
Validate::isTrue(
$permission == '',
sprintf(
Resources::INVALID_PERMISSION_PROVIDED,
$this->getResourceType(),
implode(', ', $validPermissions)
)
);
return $result;
}
/**
* Converts this current object to XML representation.
*
* @internal
*
* @return array
*/
public function toArray()
{
$array = array();
if ($this->getStart() != null) {
$array[Resources::XTAG_SIGNED_START] =
Utilities::convertToEdmDateTime($this->getStart());
}
$array[Resources::XTAG_SIGNED_EXPIRY] =
Utilities::convertToEdmDateTime($this->getExpiry());
$array[Resources::XTAG_SIGNED_PERMISSION] = $this->getPermission();
return $array;
}
}
@@ -0,0 +1,269 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Validate;
/**
* Provides functionality and data structure for Cross-Origin Resource Sharing
* rules.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 CORS
{
private $allowedOrigins;
private $allowedMethods;
private $allowedHeaders;
private $exposedHeaders;
private $maxAgeInSeconds;
/**
* Constructor of the class.
*
* @param string[] $allowedOrigins The origin domains that are permitted
* to make request against the storage
* service via CORS.
* @param string[] $allowedMethods The methods (HTTP request verbs) that
* the origin domain may use for a CORS
* request.
* @param string[] $allowedHeaders The request headers that the origin
* domain may specify on the CORS request.
* @param string[] $exposedHeaders The response headers that may be sent in
* the response to the CORS request and
* exposed by the browser to the request
* issuer.
* @param int $maxAgeInSeconds The maximum amount of time that a
* browser should cache the preflight
* OPTIONS request.
*/
public function __construct(
array $allowedOrigins,
array $allowedMethods,
array $allowedHeaders,
array $exposedHeaders,
$maxAgeInSeconds
) {
$this->setAllowedOrigins($allowedOrigins);
$this->setAllowedMethods($allowedMethods);
$this->setAllowedHeaders($allowedHeaders);
$this->setExposedHeaders($exposedHeaders);
$this->setMaxedAgeInSeconds($maxAgeInSeconds);
}
/**
* Create an instance with parsed XML response with 'CORS' root.
*
* @param array $parsedResponse The response used to create an instance.
*
* @internal
*
* @return CORS
*/
public static function create(array $parsedResponse)
{
Validate::hasKey(
Resources::XTAG_ALLOWED_ORIGINS,
'parsedResponse',
$parsedResponse
);
Validate::hasKey(
Resources::XTAG_ALLOWED_METHODS,
'parsedResponse',
$parsedResponse
);
Validate::hasKey(
Resources::XTAG_ALLOWED_HEADERS,
'parsedResponse',
$parsedResponse
);
Validate::hasKey(
Resources::XTAG_EXPOSED_HEADERS,
'parsedResponse',
$parsedResponse
);
Validate::hasKey(
Resources::XTAG_MAX_AGE_IN_SECONDS,
'parsedResponse',
$parsedResponse
);
// Get the values from the parsed response.
$allowedOrigins = array_filter(explode(
',',
$parsedResponse[Resources::XTAG_ALLOWED_ORIGINS]
));
$allowedMethods = array_filter(explode(
',',
$parsedResponse[Resources::XTAG_ALLOWED_METHODS]
));
$allowedHeaders = array_filter(explode(
',',
$parsedResponse[Resources::XTAG_ALLOWED_HEADERS]
));
$exposedHeaders = array_filter(explode(
',',
$parsedResponse[Resources::XTAG_EXPOSED_HEADERS]
));
$maxAgeInSeconds = intval(
$parsedResponse[Resources::XTAG_MAX_AGE_IN_SECONDS]
);
return new CORS(
$allowedOrigins,
$allowedMethods,
$allowedHeaders,
$exposedHeaders,
$maxAgeInSeconds
);
}
/**
* Converts this object to array with XML tags
*
* @return array
*/
public function toArray()
{
return array(
Resources::XTAG_ALLOWED_ORIGINS =>
implode(',', $this->getAllowedOrigins()),
Resources::XTAG_ALLOWED_METHODS =>
implode(',', $this->getAllowedMethods()),
Resources::XTAG_ALLOWED_HEADERS =>
implode(',', $this->getAllowedHeaders()),
Resources::XTAG_EXPOSED_HEADERS =>
implode(',', $this->getExposedHeaders()),
Resources::XTAG_MAX_AGE_IN_SECONDS =>
$this->getMaxedAgeInSeconds()
);
}
/**
* Setter for allowedOrigins
*
* @param string[] $allowedOrigins the allowed origins to be set.
*/
public function setAllowedOrigins(array $allowedOrigins)
{
$this->allowedOrigins = $allowedOrigins;
}
/**
* Getter for allowedOrigins
*
* @return string[]
*/
public function getAllowedOrigins()
{
return $this->allowedOrigins;
}
/**
* Setter for allowedMethods
*
* @param string[] $allowedMethods the allowed methods to be set.
*/
public function setAllowedMethods(array $allowedMethods)
{
$this->allowedMethods = $allowedMethods;
}
/**
* Getter for allowedMethods
*
* @return string[]
*/
public function getAllowedMethods()
{
return $this->allowedMethods;
}
/**
* Setter for allowedHeaders
*
* @param string[] $allowedHeaders the allowed headers to be set.
*/
public function setAllowedHeaders(array $allowedHeaders)
{
$this->allowedHeaders = $allowedHeaders;
}
/**
* Getter for allowedHeaders
*
* @return string[]
*/
public function getAllowedHeaders()
{
return $this->allowedHeaders;
}
/**
* Setter for exposedHeaders
*
* @param string[] $exposedHeaders the exposed headers to be set.
*/
public function setExposedHeaders(array $exposedHeaders)
{
$this->exposedHeaders = $exposedHeaders;
}
/**
* Getter for exposedHeaders
*
* @return string[]
*/
public function getExposedHeaders()
{
return $this->exposedHeaders;
}
/**
* Setter for maxAgeInSeconds
*
* @param int $maxAgeInSeconds the max age in seconds to be set.
*/
public function setMaxedAgeInSeconds($maxAgeInSeconds)
{
$this->maxAgeInSeconds = $maxAgeInSeconds;
}
/**
* Getter for maxAgeInSeconds
*
* @return int
*/
public function getMaxedAgeInSeconds()
{
return $this->maxAgeInSeconds;
}
}
@@ -0,0 +1,82 @@
<?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 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\LocationMode;
/**
* Provides functionality and data structure for continuation token.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 ContinuationToken
{
private $location;
public function __construct(
$location = ''
) {
$this->setLocation($location);
}
/**
* Setter for location
*
* @param string $location the location to be set.
*/
public function setLocation($location)
{
Validate::canCastAsString($location, 'location');
Validate::isTrue(
$location == LocationMode::PRIMARY_ONLY ||
$location == LocationMode::SECONDARY_ONLY ||
$location == '',
sprintf(
Resources::INVALID_VALUE_MSG,
'location',
LocationMode::PRIMARY_ONLY . ' or ' . LocationMode::SECONDARY_ONLY
)
);
$this->location = $location;
}
/**
* Getter for location
*
* @return string
*/
public function getLocation()
{
return $this->location;
}
}
@@ -0,0 +1,78 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
/**
* Result from calling GetServiceProperties REST wrapper.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 GetServicePropertiesResult
{
private $_serviceProperties;
/**
* Creates object from $parsedResponse.
*
* @internal
* @param array $parsedResponse XML response parsed into array.
*
* @return \MicrosoftAzure\Storage\Common\Models\GetServicePropertiesResult
*/
public static function create(array $parsedResponse)
{
$result = new GetServicePropertiesResult();
$result->setValue(ServiceProperties::create($parsedResponse));
return $result;
}
/**
* Gets service properties object.
*
* @return \MicrosoftAzure\Storage\Common\Models\ServiceProperties
*/
public function getValue()
{
return $this->_serviceProperties;
}
/**
* Sets service properties object.
*
* @param ServiceProperties $serviceProperties object to use.
*
* @return void
*/
protected function setValue($serviceProperties)
{
$this->_serviceProperties = clone $serviceProperties;
}
}
@@ -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\Common\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\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
/**
* Result from calling get service stats REST wrapper.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 GetServiceStatsResult
{
private $status;
private $lastSyncTime;
/**
* Creates object from $parsedResponse.
*
* @internal
* @param array $parsedResponse XML response parsed into array.
*
* @return \MicrosoftAzure\Storage\Common\Models\GetServiceStatsResult
*/
public static function create(array $parsedResponse)
{
$result = new GetServiceStatsResult();
if (Utilities::arrayKeyExistsInsensitive(
Resources::XTAG_GEO_REPLICATION,
$parsedResponse
)) {
$geoReplication = $parsedResponse[Resources::XTAG_GEO_REPLICATION];
if (Utilities::arrayKeyExistsInsensitive(
Resources::XTAG_STATUS,
$geoReplication
)) {
$result->setStatus($geoReplication[Resources::XTAG_STATUS]);
}
if (Utilities::arrayKeyExistsInsensitive(
Resources::XTAG_LAST_SYNC_TIME,
$geoReplication
)) {
$lastSyncTime = $geoReplication[Resources::XTAG_LAST_SYNC_TIME];
$result->setLastSyncTime(Utilities::convertToDateTime($lastSyncTime));
}
}
return $result;
}
/**
* Gets status of the result.
*
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* Gets the last sync time.
* @return \DateTime
*/
public function getLastSyncTime()
{
return $this->lastSyncTime;
}
/**
* Sets status of the result.
*
* @return void
*/
protected function setStatus($status)
{
$this->status = $status;
}
/**
* Sets the last sync time.
*
* @return void
*/
protected function setLastSyncTime(\DateTime $lastSyncTime)
{
$this->lastSyncTime = $lastSyncTime;
}
}
@@ -0,0 +1,198 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
/**
* Holds elements of queue properties logging field.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 Logging
{
private $_version;
private $_delete;
private $_read;
private $_write;
private $_retentionPolicy;
/**
* Creates object from $parsedResponse.
*
* @internal
* @param array $parsedResponse XML response parsed into array.
*
* @return Logging
*/
public static function create(array $parsedResponse)
{
$result = new Logging();
$result->setVersion($parsedResponse['Version']);
$result->setDelete(Utilities::toBoolean($parsedResponse['Delete']));
$result->setRead(Utilities::toBoolean($parsedResponse['Read']));
$result->setWrite(Utilities::toBoolean($parsedResponse['Write']));
$result->setRetentionPolicy(
RetentionPolicy::create($parsedResponse['RetentionPolicy'])
);
return $result;
}
/**
* Gets the retention policy
*
* @return MicrosoftAzure\Storage\Common\Models\RetentionPolicy
*
*/
public function getRetentionPolicy()
{
return $this->_retentionPolicy;
}
/**
* Sets retention policy
*
* @param RetentionPolicy $policy object to use
*
* @return void
*/
public function setRetentionPolicy(RetentionPolicy $policy)
{
$this->_retentionPolicy = $policy;
}
/**
* Gets whether all write requests should be logged.
*
* @return bool.
*/
public function getWrite()
{
return $this->_write;
}
/**
* Sets whether all write requests should be logged.
*
* @param bool $write new value.
*
* @return void
*/
public function setWrite($write)
{
$this->_write = $write;
}
/**
* Gets whether all read requests should be logged.
*
* @return bool
*/
public function getRead()
{
return $this->_read;
}
/**
* Sets whether all read requests should be logged.
*
* @param bool $read new value.
*
* @return void
*/
public function setRead($read)
{
$this->_read = $read;
}
/**
* Gets whether all delete requests should be logged.
*
* @return void
*/
public function getDelete()
{
return $this->_delete;
}
/**
* Sets whether all delete requests should be logged.
*
* @param bool $delete new value.
*
* @return void
*/
public function setDelete($delete)
{
$this->_delete = $delete;
}
/**
* Gets the version of Storage Analytics to configure
*
* @return string
*/
public function getVersion()
{
return $this->_version;
}
/**
* Sets the version of Storage Analytics to configure
*
* @param string $version new value.
*
* @return void
*/
public function setVersion($version)
{
$this->_version = $version;
}
/**
* Converts this object to array with XML tags
*
* @internal
* @return array
*/
public function toArray()
{
return array(
'Version' => $this->_version,
'Delete' => Utilities::booleanToString($this->_delete),
'Read' => Utilities::booleanToString($this->_read),
'Write' => Utilities::booleanToString($this->_write),
'RetentionPolicy' => !empty($this->_retentionPolicy)
? $this->_retentionPolicy->toArray()
: null
);
}
}
@@ -0,0 +1,72 @@
<?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 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Validate;
/**
* Provides functionality and data structure for continuation token that
* contains next marker.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 MarkerContinuationToken extends ContinuationToken
{
private $nextMarker;
public function __construct(
$nextMarker = '',
$location = ''
) {
parent::__construct($location);
$this->setNextMarker($nextMarker);
}
/**
* Setter for nextMarker
*
* @param string $nextMarker the next marker to be set.
*/
public function setNextMarker($nextMarker)
{
Validate::canCastAsString($nextMarker, 'nextMarker');
$this->nextMarker = $nextMarker;
}
/**
* Getter for nextMarker
*
* @return string
*/
public function getNextMarker()
{
return $this->nextMarker;
}
}
@@ -0,0 +1,181 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
/**
* Holds elements of queue properties metrics field.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 Metrics
{
private $_version;
private $_enabled;
private $_includeAPIs;
private $_retentionPolicy;
/**
* Creates object from $parsedResponse.
*
* @internal
* @param array $parsedResponse XML response parsed into array.
*
* @return Metrics
*/
public static function create(array $parsedResponse)
{
$result = new Metrics();
$result->setVersion($parsedResponse['Version']);
$result->setEnabled(Utilities::toBoolean($parsedResponse['Enabled']));
if ($result->getEnabled()) {
$result->setIncludeAPIs(
Utilities::toBoolean($parsedResponse['IncludeAPIs'])
);
}
$result->setRetentionPolicy(
RetentionPolicy::create($parsedResponse['RetentionPolicy'])
);
return $result;
}
/**
* Gets retention policy
*
* @return RetentionPolicy
*
*/
public function getRetentionPolicy()
{
return $this->_retentionPolicy;
}
/**
* Sets retention policy
*
* @param RetentionPolicy $policy object to use
*
* @return void
*/
public function setRetentionPolicy(RetentionPolicy $policy)
{
$this->_retentionPolicy = $policy;
}
/**
* Gets include APIs.
*
* @return bool
*/
public function getIncludeAPIs()
{
return $this->_includeAPIs;
}
/**
* Sets include APIs.
*
* @param bool $includeAPIs value to use.
*
* @return void
*/
public function setIncludeAPIs($includeAPIs)
{
$this->_includeAPIs = $includeAPIs;
}
/**
* Gets enabled.
*
* @return bool
*/
public function getEnabled()
{
return $this->_enabled;
}
/**
* Sets enabled.
*
* @param bool $enabled value to use.
*
* @return void
*/
public function setEnabled($enabled)
{
$this->_enabled = $enabled;
}
/**
* Gets version
*
* @return string
*/
public function getVersion()
{
return $this->_version;
}
/**
* Sets version
*
* @param string $version new value.
*
* @return void
*/
public function setVersion($version)
{
$this->_version = $version;
}
/**
* Converts this object to array with XML tags
*
* @internal
* @return array
*/
public function toArray()
{
$array = array(
'Version' => $this->_version,
'Enabled' => Utilities::booleanToString($this->_enabled)
);
if ($this->_enabled) {
$array['IncludeAPIs'] = Utilities::booleanToString($this->_includeAPIs);
}
$array['RetentionPolicy'] = !empty($this->_retentionPolicy)
? $this->_retentionPolicy->toArray()
: null;
return $array;
}
}
@@ -0,0 +1,142 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
/**
* Holds info about resource+ range used in HTTP requests
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 Range
{
private $start;
private $end;
/**
* Constructor
*
* @param integer $start the resource start value
* @param integer $end the resource end value
*
* @return Range
*/
public function __construct($start, $end = null)
{
$this->start = $start;
$this->end = $end;
}
/**
* Sets resource start range
*
* @param integer $start the resource range start
*
* @return void
*/
public function setStart($start)
{
$this->start = $start;
}
/**
* Gets resource start range
*
* @return integer
*/
public function getStart()
{
return $this->start;
}
/**
* Sets resource end range
*
* @param integer $end the resource range end
*
* @return void
*/
public function setEnd($end)
{
$this->end = $end;
}
/**
* Gets resource end range
*
* @return integer
*/
public function getEnd()
{
return $this->end;
}
/**
* Gets resource range length
*
* @return integer
*/
public function getLength()
{
if ($this->end != null) {
return $this->end - $this->start + 1;
} else {
return null;
}
}
/**
* Sets resource range length
*
* @param integer $value new resource range
*
* @return void
*/
public function setLength($value)
{
$this->end = $this->start + $value - 1;
}
/**
* Constructs the range string according to the set start and end
*
* @return string
*/
public function getRangeString()
{
$rangeString = '';
$rangeString .= ('bytes=' . $this->start . '-');
if ($this->end != null) {
$rangeString .= $this->end;
}
return $rangeString;
}
}
@@ -0,0 +1,75 @@
<?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 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
/**
* Holds info about page blob range diffs
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 RangeDiff extends Range
{
private $isClearedPageRange;
/**
* Constructor
*
* @param integer $start the resource start value
* @param integer $end the resource end value
* @param bool $isClearedPageRange true if the page range is a cleared range, false otherwise.
*/
public function __construct($start, $end = null, $isClearedPageRange = false)
{
parent::__construct($start, $end);
$this->isClearedPageRange = $isClearedPageRange;
}
/**
* True if the page range is a cleared range, false otherwise
*
* @return bool
*/
public function isClearedPageRange()
{
return $this->isClearedPageRange;
}
/**
* Sets the isClearedPageRange property
*
* @param bool $isClearedPageRange
*
* @return bool
*/
public function setIsClearedPageRange($isClearedPageRange)
{
$this->isClearedPageRange = $isClearedPageRange;
}
}
@@ -0,0 +1,124 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Utilities;
/**
* Holds elements of queue properties retention policy field.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 RetentionPolicy
{
private $_enabled;
private $_days;
/**
* Creates object from $parsedResponse.
*
* @param array $parsedResponse XML response parsed into array.
*
* @internal
*
* @return MicrosoftAzure\Storage\Common\Models\RetentionPolicy
*/
public static function create(array $parsedResponse = null)
{
$result = new RetentionPolicy();
$result->setEnabled(Utilities::toBoolean($parsedResponse['Enabled']));
if ($result->getEnabled()) {
$result->setDays(intval($parsedResponse['Days']));
}
return $result;
}
/**
* Gets enabled.
*
* @return bool
*/
public function getEnabled()
{
return $this->_enabled;
}
/**
* Sets enabled.
*
* @param bool $enabled value to use.
*
* @return void
*/
public function setEnabled($enabled)
{
$this->_enabled = $enabled;
}
/**
* Gets days field.
*
* @return int
*/
public function getDays()
{
return $this->_days;
}
/**
* Sets days field.
*
* @param int $days value to use.
*
* @return void
*/
public function setDays($days)
{
$this->_days = $days;
}
/**
* Converts this object to array with XML tags
*
* @internal
*
* @return array
*/
public function toArray()
{
$array = array('Enabled' => Utilities::booleanToString($this->_enabled));
if (isset($this->_days)) {
$array['Days'] = strval($this->_days);
}
return $array;
}
}
@@ -0,0 +1,309 @@
<?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 2017 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\LocationMode;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Validate;
use MicrosoftAzure\Storage\Common\Middlewares\MiddlewareStack;
use MicrosoftAzure\Storage\Common\Middlewares\IMiddleware;
/**
* This class provides the base structure of service options, granting user to
* send with different options for each individual API call.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 ServiceOptions
{
/**
* The middlewares to be applied using the operation.
* @internal
*/
protected $middlewares;
/**
* The middleware stack used for the operation.
* @internal
*/
protected $middlewareStack;
/**
* The number of concurrency when performing concurrent requests.
* @internal
*/
protected $numberOfConcurrency;
/**
* If streamming is used for the operation.
* @internal
*/
protected $isStreaming;
/**
* The location mode of the operation.
* @internal
*/
protected $locationMode;
/**
* If to decode the content of the response body.
* @internal
*/
protected $decodeContent;
/**
* The timeout of the operation
* @internal
*/
protected $timeout;
/**
* Initialize the properties to default value.
*/
public function __construct(ServiceOptions $options = null)
{
if ($options == null) {
$this->setNumberOfConcurrency(Resources::NUMBER_OF_CONCURRENCY);
$this->setLocationMode(LocationMode::PRIMARY_ONLY);
$this->setIsStreaming(false);
$this->setDecodeContent(false);
$this->middlewares = array();
$this->middlewareStack = null;
} else {
$this->setNumberOfConcurrency($options->getNumberOfConcurrency());
$this->setLocationMode($options->getLocationMode());
$this->setIsStreaming($options->getIsStreaming());
$this->setDecodeContent($options->getDecodeContent());
$this->middlewares = $options->getMiddlewares();
$this->middlewareStack = $options->getMiddlewareStack();
}
}
/**
* Push a middleware into the middlewares.
* @param callable|IMiddleware $middleware middleware to be pushed.
*
* @return void
*/
public function pushMiddleware($middleware)
{
self::validateIsMiddleware($middleware);
$this->middlewares[] = $middleware;
}
/**
* Gets the middlewares.
*
* @return array
*/
public function getMiddlewares()
{
return $this->middlewares;
}
/**
* Sets middlewares.
*
* @param array $middlewares value.
*
* @return void
*/
public function setMiddlewares(array $middlewares)
{
foreach ($middlewares as $middleware) {
self::validateIsMiddleware($middleware);
}
$this->middlewares = $middlewares;
}
/**
* Gets the middleware stack
*
* @return MiddlewareStack
*/
public function getMiddlewareStack()
{
return $this->middlewareStack;
}
/**
* Sets the middleware stack.
*
* @param MiddlewareStack $middlewareStack value.
*
* @return void
*/
public function setMiddlewareStack(MiddlewareStack $middlewareStack)
{
$this->middlewareStack = $middlewareStack;
}
/**
* Gets the number of concurrency value
*
* @return int
*/
public function getNumberOfConcurrency()
{
return $this->numberOfConcurrency;
}
/**
* Sets number of concurrency.
*
* @param int $numberOfConcurrency value.
*
* @return void
*/
public function setNumberOfConcurrency($numberOfConcurrency)
{
$this->numberOfConcurrency = $numberOfConcurrency;
}
/**
* Gets the isStreaming value
*
* @return bool
*/
public function getIsStreaming()
{
return $this->isStreaming;
}
/**
* Sets isStreaming.
*
* @param bool $isStreaming value.
*
* @return void
*/
public function setIsStreaming($isStreaming)
{
$this->isStreaming = $isStreaming;
}
/**
* Gets the locationMode value
*
* @return string
*/
public function getLocationMode()
{
return $this->locationMode;
}
/**
* Sets locationMode.
*
* @param string $locationMode value.
*
* @return void
*/
public function setLocationMode($locationMode)
{
$this->locationMode = $locationMode;
}
/**
* Gets the decodeContent value
*
* @return bool
*/
public function getDecodeContent()
{
return $this->decodeContent;
}
/**
* Sets decodeContent.
*
* @param bool $decodeContent value.
*
* @return void
*/
public function setDecodeContent($decodeContent)
{
$this->decodeContent = $decodeContent;
}
/**
* Gets the timeout value
*
* @return string
*/
public function getTimeout()
{
return $this->timeout;
}
/**
* Sets timeout.
*
* @param string $timeout value.
*
* @return void
*/
public function setTimeout($timeout)
{
$this->timeout = $timeout;
}
/**
* Generate request options using the input options and saved properties.
*
* @param array $options The options to be merged for the request options.
*
* @return array
*/
public function generateRequestOptions(array $options)
{
$result = array();
return $result;
}
/**
* Validate if the given middleware is of callable or IMiddleware.
*
* @param void $middleware the middleware to be validated.
*
* @return void
*/
private static function validateIsMiddleware($middleware)
{
if (!(is_callable($middleware) || $middleware instanceof IMiddleware)) {
Validate::isTrue(
false,
Resources::INVALID_TYPE_MSG . 'callable or IMiddleware'
);
}
}
}
@@ -0,0 +1,279 @@
<?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 2016 Microsoft Corporation
* @license https://github.com/azure/azure-storage-php/LICENSE
* @link https://github.com/azure/azure-storage-php
*/
namespace MicrosoftAzure\Storage\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\Internal\Serialization\XmlSerializer;
/**
* Encapsulates service properties
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 ServiceProperties
{
private $logging;
private $hourMetrics;
private $minuteMetrics;
private $corses;
private $defaultServiceVersion;
private static $xmlRootName = 'StorageServiceProperties';
/**
* Creates ServiceProperties object from parsed XML response.
*
* @internal
* @param array $parsedResponse XML response parsed into array.
*
* @return ServiceProperties.
*/
public static function create(array $parsedResponse)
{
$result = new ServiceProperties();
if (array_key_exists(Resources::XTAG_DEFAULT_SERVICE_VERSION, $parsedResponse) &&
$parsedResponse[Resources::XTAG_DEFAULT_SERVICE_VERSION] != null) {
$result->setDefaultServiceVersion($parsedResponse[Resources::XTAG_DEFAULT_SERVICE_VERSION]);
}
if (array_key_exists(Resources::XTAG_LOGGING, $parsedResponse)) {
$result->setLogging(Logging::create($parsedResponse[Resources::XTAG_LOGGING]));
}
$result->setHourMetrics(Metrics::create($parsedResponse[Resources::XTAG_HOUR_METRICS]));
if (array_key_exists(Resources::XTAG_MINUTE_METRICS, $parsedResponse)) {
$result->setMinuteMetrics(Metrics::create($parsedResponse[Resources::XTAG_MINUTE_METRICS]));
}
if (array_key_exists(Resources::XTAG_CORS, $parsedResponse) &&
$parsedResponse[Resources::XTAG_CORS] != null) {
//There could be multiple CORS rules, so need to extract them all.
$corses = array();
$corsArray =
$parsedResponse[Resources::XTAG_CORS][Resources::XTAG_CORS_RULE];
if (count(array_filter(array_keys($corsArray), 'is_string')) > 0) {
//single cors rule
$corses[] = CORS::create($corsArray);
} else {
//multiple cors rule
foreach ($corsArray as $cors) {
$corses[] = CORS::create($cors);
}
}
$result->setCorses($corses);
} else {
$result->setCorses(array());
}
return $result;
}
/**
* Gets logging element.
*
* @return Logging
*/
public function getLogging()
{
return $this->logging;
}
/**
* Sets logging element.
*
* @param Logging $logging new element.
*
* @return void
*/
public function setLogging(Logging $logging)
{
$this->logging = clone $logging;
}
/**
* Gets hour metrics element.
*
* @return Metrics
*/
public function getHourMetrics()
{
return $this->hourMetrics;
}
/**
* Sets hour metrics element.
*
* @param Metrics $metrics new element.
*
* @return void
*/
public function setHourMetrics(Metrics $hourMetrics)
{
$this->hourMetrics = clone $hourMetrics;
}
/**
* Gets minute metrics element.
*
* @return Metrics
*/
public function getMinuteMetrics()
{
return $this->minuteMetrics;
}
/**
* Sets minute metrics element.
*
* @param Metrics $metrics new element.
*
* @return void
*/
public function setMinuteMetrics(Metrics $minuteMetrics)
{
$this->minuteMetrics = clone $minuteMetrics;
}
/**
* Gets corses element.
*
* @return CORS[]
*/
public function getCorses()
{
return $this->corses;
}
/**
* Sets corses element.
*
* @param CORS[] $corses new elements.
*
* @return void
*/
public function setCorses(array $corses)
{
$this->corses = $corses;
}
/**
* Gets the default service version.
*
* @return string
*/
public function getDefaultServiceVersion()
{
return $this->defaultServiceVersion;
}
/**
* Sets the default service version. This can obly be set for the blob service.
*
* @param string $defaultServiceVersion the default service version
*
* @return void
*/
public function setDefaultServiceVersion($defaultServiceVersion)
{
$this->defaultServiceVersion = $defaultServiceVersion;
}
/**
* Converts this object to array with XML tags
*
* @internal
* @return array
*/
public function toArray()
{
$result = array();
if (!empty($this->getLogging())) {
$result[Resources::XTAG_LOGGING] =
$this->getLogging()->toArray();
}
if (!empty($this->getHourMetrics())) {
$result[Resources::XTAG_HOUR_METRICS] =
$this->getHourMetrics()->toArray();
}
if (!empty($this->getMinuteMetrics())) {
$result[Resources::XTAG_MINUTE_METRICS] =
$this->getMinuteMetrics()->toArray();
}
$corsesArray = $this->getCorsesArray();
if (!empty($corsesArray)) {
$result[Resources::XTAG_CORS] =$corsesArray;
}
if ($this->defaultServiceVersion != null) {
$result[Resources::XTAG_DEFAULT_SERVICE_VERSION] = $this->defaultServiceVersion;
}
return $result;
}
/**
* Gets the array that contains all the CORSes.
*
* @return array
*/
private function getCorsesArray()
{
$corsesArray = array();
if (count($this->getCorses()) == 1) {
$corsesArray = array(
Resources::XTAG_CORS_RULE => $this->getCorses()[0]->toArray()
);
} elseif ($this->getCorses() != array()) {
foreach ($this->getCorses() as $cors) {
$corsesArray[] = [Resources::XTAG_CORS_RULE => $cors->toArray()];
}
}
return $corsesArray;
}
/**
* Converts this current object to XML representation.
*
* @internal
* @param XmlSerializer $xmlSerializer The XML serializer.
*
* @return string
*/
public function toXml(XmlSerializer $xmlSerializer)
{
$properties = array(XmlSerializer::ROOT_NAME => self::$xmlRootName);
return $xmlSerializer->serialize($this->toArray(), $properties);
}
}
@@ -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\Common\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\Common\Models;
use MicrosoftAzure\Storage\Common\Internal\Resources;
/**
* Holds signed identifiers.
*
* @category Microsoft
* @package MicrosoftAzure\Storage\Common\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 SignedIdentifier
{
private $id;
private $accessPolicy;
/**
* Constructor
*
* @param string $id The id of this signed identifier.
* @param AccessPolicy|null $accessPolicy The access policy.
*/
public function __construct($id = '', AccessPolicy $accessPolicy = null)
{
$this->setId($id);
$this->setAccessPolicy($accessPolicy);
}
/**
* Gets id.
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Sets id.
*
* @param string $id value.
*
* @return void
*/
public function setId($id)
{
$this->id = $id;
}
/**
* Gets accessPolicy.
*
* @return AccessPolicy
*/
public function getAccessPolicy()
{
return $this->accessPolicy;
}
/**
* Sets accessPolicy.
*
* @param AccessPolicy|null $accessPolicy value.
*
* @return void
*/
public function setAccessPolicy(AccessPolicy $accessPolicy = null)
{
$this->accessPolicy = $accessPolicy;
}
/**
* Converts this current object to XML representation.
*
* @internal
*
* @return array
*/
public function toArray()
{
$array = array();
$accessPolicyArray = array();
$accessPolicyArray[Resources::XTAG_SIGNED_ID] = $this->getId();
$accessPolicyArray[Resources::XTAG_ACCESS_POLICY] =
$this->getAccessPolicy()->toArray();
$array[Resources::XTAG_SIGNED_IDENTIFIER] = $accessPolicyArray;
return $array;
}
}
@@ -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\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\Common\Models;
/**
* Trait implementing setting and getting useTransactionalMD5 for
* option classes which need support transactional MD5 validation
* during data transferring.
*
* @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
*/
trait TransactionalMD5Trait
{
/** @var $useTransactionalMD5 boolean */
private $useTransactionalMD5;
/**
* Gets whether using transactional MD5 validation.
*
* @return boolean
*/
public function getUseTransactionalMD5()
{
return $this->useTransactionalMD5;
}
/**
* Sets whether using transactional MD5 validation.
*
* @param boolean $useTransactionalMD5 whether enable transactional
* MD5 validation.
*/
public function setUseTransactionalMD5($useTransactionalMD5)
{
$this->useTransactionalMD5 = $useTransactionalMD5;
}
}