/**
  * Regenerates the primary or secondary access key for the specified storage 
  * account.
  * 
  * @param string $name    The storage account name.
  * @param string $keyType Specifies which key to regenerate.
  * 
  * @return Models\GetStorageServiceKeysResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee460795.aspx
  */
 public function regenerateStorageServiceKeys($name, $keyType)
 {
     Validate::isString($name, 'name');
     Validate::notNullOrEmpty($name, 'name');
     Validate::isString($keyType, '$keyType');
     Validate::notNullOrEmpty($keyType, '$keyType');
     $properties = array(XmlSerializer::ROOT_NAME => 'RegenerateKeys');
     $reqArray = array(Resources::XTAG_NAMESPACE => array(Resources::WA_XML_NAMESPACE => null), Resources::XTAG_KEY_TYPE => $keyType);
     $body = $this->dataSerializer->serialize($reqArray, $properties);
     $context = new HttpCallContext();
     $context->setMethod(Resources::HTTP_POST);
     $context->setPath($this->_getStorageServiceKeysPath($name));
     $context->addStatusCode(Resources::STATUS_OK);
     $context->addQueryParameter(Resources::QP_ACTION, 'regenerate');
     $context->setBody($body);
     $context->addHeader(Resources::CONTENT_TYPE, Resources::XML_ATOM_CONTENT_TYPE);
     $response = $this->sendContext($context);
     $parsed = $this->dataSerializer->unserialize($response->getBody());
     return GetStorageServiceKeysResult::create($parsed);
 }
 /**
  * The base method of all the list operations. 
  * 
  * @param ListOptions $listOptions The options for list operation. 
  * @param string      $path        The path of the list operation.
  *
  * @return none
  */
 private function _listOptions($listOptions, $path)
 {
     if (is_null($listOptions)) {
         $listOptions = new ListOptions();
     }
     $httpCallContext = new HttpCallContext();
     $httpCallContext->setMethod(Resources::HTTP_GET);
     $httpCallContext->setPath($path);
     $httpCallContext->addStatusCode(Resources::STATUS_OK);
     $top = $listOptions->getTop();
     $skip = $listOptions->getSkip();
     if (!empty($top)) {
         $httpCallContext->addQueryParameter(Resources::QP_TOP, $top);
     }
     if (!empty($skip)) {
         $httpCallContext->addQueryParameter(Resources::QP_SKIP, $skip);
     }
     return $this->sendContext($httpCallContext);
 }
예제 #3
0
 /**
  * Cancels an in progress configuration change (update) or upgrade and returns
  * the deployment to its state before the upgrade or configuration change was
  * started.
  *
  * Note that you can rollback update or upgrade either by specifying the
  * deployment environment (staging or production), or by specifying the
  * deployment's unique name.
  *
  * @param string               $name    The hosted service name.
  * @param string               $mode    Specifies whether the rollback
  * should proceed automatically or not. Auto, The rollback proceeds without
  * further user input. Manual, You must call the walkUpgradeDomain API to apply
  * the rollback to each upgrade domain.
  * @param boolean              $force   Specifies whether the rollback
  * should proceed even when it will cause local data to be lost from some role
  * instances. True if the rollback should proceed; otherwise false if the
  * rollback should fail.
  * @param GetDeploymentOptions $options The optional parameters.
  *
  * @return none
  *
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh403977.aspx
  */
 public function rollbackUpdateOrUpgrade($name, $mode, $force, $options)
 {
     Validate::isString($name, 'name');
     Validate::notNullOrEmpty($name, 'name');
     Validate::isString($mode, 'mode');
     Validate::isTrue(Mode::isValid($mode), Resources::INVALID_CHANGE_MODE_MSG);
     Validate::isBoolean($force, 'force');
     Validate::notNullOrEmpty($force, 'force');
     Validate::notNullOrEmpty($options, 'options');
     $xmlElements = array(Resources::XTAG_MODE => $mode, Resources::XTAG_FORCE => Utilities::booleanToString($force));
     $body = $this->_createRequestXml($xmlElements, Resources::XTAG_ROLLBACK_UPDATE_OR_UPGRADE);
     $context = new HttpCallContext();
     $context->setMethod(Resources::HTTP_POST);
     $context->setPath($this->_getDeploymentPath($name, $options) . '/');
     $context->addStatusCode(Resources::STATUS_ACCEPTED);
     $context->addQueryParameter(Resources::QP_COMP, Resources::QPV_ROLLBACK);
     $context->setBody($body);
     $context->addHeader(Resources::CONTENT_TYPE, Resources::XML_CONTENT_TYPE);
     assert(Utilities::endsWith($context->getPath(), '/'));
     $response = $this->sendContext($context);
     return AsynchronousOperationResult::create($response->getHeader());
 }