/** * Creates a new storage account in Windows Azure. * * In the optional parameters either location or affinity group must be provided. * Because Create Storage Account is an asynchronous operation, it always returns * status code 202 (Accepted). To determine the status code for the operation * once it is complete, call getOperationStatus API. The status code is embedded * in the response for this operation; if successful, it will be * status code 200 (OK). * * @param string $name The storage account name. * @param string $label Name for the storage * account specified as a base64-encoded string. The name may be up to 100 * characters in length. The name can be used identify the storage account for * your tracking purposes. * @param Models\CreateStorageServiceOptions $options The optional parameters. * * @return Models\AsynchronousOperationResult * * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh264518.aspx */ public function createStorageService($name, $label, $options) { Validate::isString($name, 'name'); Validate::notNullOrEmpty($name, 'name'); Validate::isString($label, 'label'); Validate::notNullOrEmpty($label, 'label'); Validate::notNullOrEmpty($options, 'options'); $affinityGroup = $options->getAffinityGroup(); $location = $options->getLocation(); Validate::isTrue(!empty($location) || !empty($affinityGroup), Resources::INVALID_CSA_OPT_MSG); $storageService = new StorageService(); $storageService->setName($name); $storageService->setLabel($label); $storageService->setLocation($options->getLocation()); $storageService->setAffinityGroup($options->getAffinityGroup()); $storageService->setDescription($options->getDescription()); $storageService->addSerializationProperty(XmlSerializer::ROOT_NAME, 'CreateStorageServiceInput'); $context = new HttpCallContext(); $context->setMethod(Resources::HTTP_POST); $context->setPath($this->_getStorageServicePath()); $context->addStatusCode(Resources::STATUS_ACCEPTED); $context->setBody($storageService->serialize($this->dataSerializer)); $context->addHeader(Resources::CONTENT_TYPE, Resources::XML_ATOM_CONTENT_TYPE); $response = $this->sendContext($context); return AsynchronousOperationResult::create($response->getHeader()); }