/**
  * @covers WindowsAzure\ServiceManagement\Models\GetStorageServiceKeysResult::setSecondary
  * @covers WindowsAzure\ServiceManagement\Models\GetStorageServiceKeysResult::getSecondary
  */
 public function testSetSecondary()
 {
     // Setup
     $expected = 'Secondary';
     $result = new GetStorageServiceKeysResult();
     // Test
     $result->setSecondary($expected);
     // Assert
     $this->assertEquals($expected, $result->getSecondary());
 }
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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 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');
     $body = $this->_createRequestXml(array(Resources::XTAG_KEY_TYPE => $keyType), Resources::XTAG_REGENERATE_KEYS);
     $context = new HttpCallContext();
     $context->setMethod(Resources::HTTP_POST);
     $context->setPath($this->_getStorageServiceKeysPath($name));
     $context->addStatusCode(Resources::STATUS_OK);
     $context->addQueryParameter(Resources::QP_ACTION, Resources::QPV_REGENERATE);
     $context->setBody($body);
     $context->addHeader(Resources::CONTENT_TYPE, Resources::XML_CONTENT_TYPE);
     $response = $this->sendContext($context);
     $parsed = $this->dataSerializer->unserialize($response->getBody());
     return GetStorageServiceKeysResult::create($parsed);
 }