コード例 #1
0
 /**
  * @covers WindowsAzure\Blob\Models\SetBlobPropertiesResult::setSequenceNumber
  * @covers WindowsAzure\Blob\Models\SetBlobPropertiesResult::getSequenceNumber
  */
 public function testSetSequenceNumber()
 {
     // Setup
     $expected = 123;
     $prooperties = new SetBlobPropertiesResult();
     $prooperties->setSequenceNumber($expected);
     // Test
     $prooperties->setSequenceNumber($expected);
     // Assert
     $this->assertEquals($expected, $prooperties->getSequenceNumber());
 }
コード例 #2
0
 /**
  * Creates SetBlobPropertiesResult from response headers.
  * 
  * @param array $headers response headers
  * 
  * @return SetBlobPropertiesResult
  */
 public static function create($headers)
 {
     $result = new SetBlobPropertiesResult();
     $date = $headers[Resources::LAST_MODIFIED];
     $result->setLastModified(Utilities::rfc1123ToDateTime($date));
     $result->setETag($headers[Resources::ETAG]);
     if (array_key_exists(Resources::X_MS_BLOB_SEQUENCE_NUMBER, $headers)) {
         $sNumber = $headers[Resources::X_MS_BLOB_SEQUENCE_NUMBER];
         $result->setSequenceNumber(intval($sNumber));
     }
     return $result;
 }
コード例 #3
0
ファイル: BlobRestProxy.php プロジェクト: yszar/linuxwp
 /**
  * Sets system properties defined for a blob.
  * 
  * @param string                          $container name of the container
  * @param string                          $blob      name of the blob
  * @param Models\SetBlobPropertiesOptions $options   optional parameters
  * 
  * @return Models\SetBlobPropertiesResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx
  */
 public function setBlobProperties($container, $blob, $options = null)
 {
     Validate::isString($container, 'container');
     Validate::isString($blob, 'blob');
     Validate::notNullOrEmpty($blob, 'blob');
     $method = Resources::HTTP_PUT;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $this->_createPath($container, $blob);
     $statusCode = Resources::STATUS_OK;
     if (is_null($options)) {
         $options = new SetBlobPropertiesOptions();
     }
     $blobContentType = $options->getBlobContentType();
     $blobContentEncoding = $options->getBlobContentEncoding();
     $blobContentLanguage = $options->getBlobContentLanguage();
     $blobContentLength = $options->getBlobContentLength();
     $blobContentMD5 = $options->getBlobContentMD5();
     $blobCacheControl = $options->getBlobCacheControl();
     $leaseId = $options->getLeaseId();
     $sNumberAction = $options->getSequenceNumberAction();
     $sNumber = $options->getSequenceNumber();
     $headers = $this->addOptionalAccessConditionHeader($headers, $options->getAccessCondition());
     $this->addOptionalHeader($headers, Resources::X_MS_LEASE_ID, $leaseId);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CACHE_CONTROL, $blobCacheControl);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_TYPE, $blobContentType);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_ENCODING, $blobContentEncoding);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_LANGUAGE, $blobContentLanguage);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_LENGTH, $blobContentLength);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_MD5, $blobContentMD5);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_SEQUENCE_NUMBER_ACTION, $sNumberAction);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_SEQUENCE_NUMBER, $sNumber);
     $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'properties');
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     return SetBlobPropertiesResult::create($response->getHeader());
 }