/** * Copies a source blob to a destination blob within the same storage account. * * @param string $destinationContainer name of the destination * container * @param string $destinationBlob name of the destination * blob * @param string $sourceContainer name of the source * container * @param string $sourceBlob name of the source * blob * @param Models\CopyBlobOptions $options optional parameters * * @return CopyBlobResult * * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx */ public function copyBlob($destinationContainer, $destinationBlob, $sourceContainer, $sourceBlob, $options = null) { $method = Resources::HTTP_PUT; $headers = array(); $postParams = array(); $queryParams = array(); $destinationBlobPath = $this->_createPath($destinationContainer, $destinationBlob); $statusCode = Resources::STATUS_CREATED; if (is_null($options)) { $options = new CopyBlobOptions(); } $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout()); $sourceBlobPath = $this->_getCopyBlobSourceName($sourceContainer, $sourceBlob, $options); $headers = $this->addOptionalAccessConditionHeader($headers, $options->getAccessCondition()); $headers = $this->addOptionalSourceAccessConditionHeader($headers, $options->getSourceAccessCondition()); $this->addOptionalHeader($headers, Resources::X_MS_COPY_SOURCE, $sourceBlobPath); $headers = $this->addMetadataHeaders($headers, $options->getMetadata()); $this->addOptionalHeader($headers, Resources::X_MS_LEASE_ID, $options->getLeaseId()); $this->addOptionalHeader($headers, Resources::X_MS_SOURCE_LEASE_ID, $options->getSourceLeaseId()); $response = $this->send($method, $headers, $queryParams, $postParams, $destinationBlobPath, $statusCode); return CopyBlobResult::create($response->getHeader()); }