/** * Deletes a blob or blob snapshot. * * Note that if the snapshot entry is specified in the $options then only this * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot * and just set getDeleteSnaphotsOnly to true. * * @param string $container name of the container * @param string $blob name of the blob * @param Models\DeleteBlobOptions $options optional parameters * * @return none * * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx */ public function deleteBlob($container, $blob, $options = null) { Validate::isString($container, 'container'); Validate::isString($blob, 'blob'); Validate::notNullOrEmpty($blob, 'blob'); $method = Resources::HTTP_DELETE; $headers = array(); $postParams = array(); $queryParams = array(); $path = $this->_createPath($container, $blob); $statusCode = Resources::STATUS_ACCEPTED; if (is_null($options)) { $options = new DeleteBlobOptions(); } if (is_null($options->getSnapshot())) { $delSnapshots = $options->getDeleteSnaphotsOnly() ? 'only' : 'include'; $this->addOptionalHeader($headers, Resources::X_MS_DELETE_SNAPSHOTS, $delSnapshots); } else { $this->addOptionalQueryParam($queryParams, Resources::QP_SNAPSHOT, $options->getSnapshot()); } $headers = $this->addOptionalAccessConditionHeader($headers, $options->getAccessCondition()); $this->addOptionalHeader($headers, Resources::X_MS_LEASE_ID, $options->getLeaseId()); $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout()); $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode); }
/** * @covers WindowsAzure\Blob\Models\DeleteBlobOptions::getSnapshot */ public function testGetSnapshot() { // Setup $blob = new DeleteBlobOptions(); $expected = TestResources::QUEUE_URI; $blob->setSnapshot($expected); // Test $actual = $blob->getSnapshot(); // Assert $this->assertEquals($expected, $actual); }