Ejemplo n.º 1
0
 /**
  * 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());
 }