/**
	 * Creates a new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature instance
	 *
	 * @param string $accountName Account name for Windows Azure
	 * @param string $accountKey Account key for Windows Azure
	 * @param boolean $usePathStyleUri Use path-style URI's
	 * @param array $permissionSet Permission set
	 */
	public function __construct(
		$accountName = Zend_Service_WindowsAzure_Credentials_AbstractCredentials::DEVSTORE_ACCOUNT,
		$accountKey  = Zend_Service_WindowsAzure_Credentials_AbstractCredentials::DEVSTORE_KEY,
		$usePathStyleUri = false, $permissionSet = array()
	) {
	    parent::__construct($accountName, $accountKey, $usePathStyleUri);
	    $this->_permissionSet = $permissionSet;
	}
Exemple #2
0
 /**
  * Perform request using Zend_Http_Client channel
  *
  * @param string $path Path
  * @param string $queryString Query string
  * @param string $httpVerb HTTP verb the request will use
  * @param array $headers x-ms headers to add
  * @param boolean $forTableStorage Is the request for table storage?
  * @param mixed $rawData Optional RAW HTTP data to be sent over the wire
  * @param string $resourceType Resource type
  * @param string $requiredPermission Required permission
  * @return Zend_Http_Response
  */
 protected function _performRequest($path = '/', $queryString = '', $httpVerb = Zend\Http\Client::GET, $headers = array(), $forTableStorage = false, $rawData = null, $resourceType = Zend_Service_WindowsAzure_Storage::RESOURCE_UNKNOWN, $requiredPermission = Zend_Service_WindowsAzure_Credentials_AbstractCredentials::PERMISSION_READ)
 {
     // Clean path
     if (strpos($path, '/') !== 0) {
         $path = '/' . $path;
     }
     // Clean headers
     if ($headers === null) {
         $headers = array();
     }
     // Ensure cUrl will also work correctly:
     //  - disable Content-Type if required
     //  - disable Expect: 100 Continue
     if (!isset($headers["Content-Type"])) {
         $headers["Content-Type"] = '';
     }
     $headers["Expect"] = '';
     // Add version header
     $headers['x-ms-version'] = $this->_apiVersion;
     // URL encoding
     $path = self::urlencode($path);
     $queryString = self::urlencode($queryString);
     // Generate URL and sign request
     $requestUrl = $this->_credentials->signRequestUrl($this->getBaseUrl() . $path . $queryString, $resourceType, $requiredPermission);
     $requestHeaders = $this->_credentials->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission);
     // Prepare request
     $this->_httpClientChannel->resetParameters(true);
     $this->_httpClientChannel->setUri($requestUrl);
     $this->_httpClientChannel->setHeaders($requestHeaders);
     $this->_httpClientChannel->setRawData($rawData);
     // Execute request
     $response = $this->_retryPolicy->execute(array($this->_httpClientChannel, 'request'), array($httpVerb));
     return $response;
 }